概述 快速入门 教程 手册 最佳实践 组件 参考 贡献

发布于 2015-08-27 16:44:07 | 99 次阅读 | 评论: 0 | 来源: 网络整理

By default the profile stores the collected data in files in the cache directory. You can control the storage being used through the dsn, username, password and lifetime options. For example, the following configuration uses MySQL as the storage for the profiler with a lifetime of one hour:

  • YAML
    # app/config/config.yml
    framework:
        profiler:
            dsn:      "mysql:host=localhost;dbname=%database_name%"
            username: "%database_user%"
            password: "%database_password%"
            lifetime: 3600
    
  • XML
    <!-- app/config/config.xml -->
    <?xml version="1.0" encoding="UTF-8" ?>
    <container xmlns="http://symfony.com/schema/dic/services"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xmlns:framework="http://symfony.com/schema/dic/symfony"
        xsi:schemaLocation="http://symfony.com/schema/dic/services
            http://symfony.com/schema/dic/services/services-1.0.xsd
            http://symfony.com/schema/dic/symfony
            http://symfony.com/schema/dic/symfony/symfony-1.0.xsd"
    >
        <framework:config>
            <framework:profiler
                dsn="mysql:host=localhost;dbname=%database_name%"
                username="%database_user%"
                password="%database_password%"
                lifetime="3600"
            />
        </framework:config>
    </container>
    
  • PHP
    // app/config/config.php
    
    // ...
    $container->loadFromExtension('framework', array(
        'profiler' => array(
            'dsn'      => 'mysql:host=localhost;dbname=%database_name%',
            'username' => '%database_user',
            'password' => '%database_password%',
            'lifetime' => 3600,
        ),
    ));
    

The HttpKernel component currently supports the following profiler storage implementations:

最新网友评论  共有(0)条评论 发布评论 返回顶部

Copyright © 2007-2017 PHPERZ.COM All Rights Reserved   冀ICP备14009818号  版权声明  广告服务