2017-06-18 64 views
0

我正在使用symfony 3.3。但是我看不到调试工具栏(_profiler),即使我做了正确的谷歌。 我也去了_profiler路线,但它说404错误。 有人可以帮我吗?Degbug工具条没有出现在我的网站的开发环境中的symfony 3.3中

以下是我config.yml和config_dev.yml

config.yml

imports: 
- { resource: parameters.yml } 
- { resource: security.yml } 
- { resource: services.yml } 

parameters: 
    locale: en 
framework: 
    profiler: 
     collect: false 
    secret: "%secret%" 
    router: 
     resource: "%kernel.root_dir%/config/routing.yml" 
     strict_requirements: ~ 
    form:   ~ 
    csrf_protection: ~ 
    validation:  { enable_annotations: true } 
    #serializer:  { enable_annotations: true } 
    templating: 
     engines: ['twig','php'] 
    default_locale: "%locale%" 
    usted_proxies: ~ 
    session: 
     # http://symfony.com/doc/current/reference/configuration /framework.html#handler-id 
    handler_id: session.handler.native_file 
    save_path: "%kernel.root_dir%/../var/sessions/%kernel.environment%" 
    fragments:  ~ 
    http_method_override: true 
    assets: ~ 
    php_errors: 
     log: true 
twig: 
    debug:   "%kernel.debug%" 
    strict_variables: "%kernel.debug 
doctrine: 
    dbal: 
     driver: pdo_mysql 
     host:  "%database_host%" 
     port:  "%database_port%" 
     dbname: "%database_name%" 
     user:  "%database_user%" 
     password: "%database_password%" 
     charset: UTF8 
    orm: 
     auto_generate_proxy_classes: "%kernel.debug%" 
     naming_strategy: doctrine.orm.naming_strategy.underscore 
     auto_mapping: true 
swiftmailer: 
     transport: "%mailer_transport%" 
     host:  "%mailer_host%" 
     username: "%mailer_user%" 
     password: "%mailer_password%" 
     spool:  { type: memory } 
kms_froala_editor: 
     language: 'en_ca' 

config_dev.yml

imports: 
- { resource: config.yml } 

framework: 
    router: 
     resource: "%kernel.root_dir%/config/routing_dev.yml" 
     strict_requirements: true 
    profiler: { only_exceptions: false } 


web_profiler: 
    toolbar: true 
    position: bottom 
    intercept_redirects: false 

monolog: 
    handlers: 
     main: 
      type: stream 
      path: "%kernel.logs_dir%/%kernel.environment%.log" 
      level: debug 
      channels: [!event] 
     console: 
      type: console 
      bubble: 
      verbosity_levels: 
       VERBOSITY_VERBOS : NOTICE 
       VERBOSITY_DEBUG : DEBUG 
       VERBOSITY_VERY_VERBOSE : NOTICE 
      channels: [!event, !doctrine] 
     # uncomment to get logging in your browser 
     # you may have to allow bigger header sizes in your Web server 

configuration 
     firephp: 
      type: firephp 
      level: info 
     chromephp: 
      type: chromephp 
      level: info 
+0

你检查如果)你的[网络服务器配置是否正确(http://symfony.com/doc/current/setup/web_server_configuration .html)和b)在您的视图中有一个有效的html文档,并带有''标签? – lordrhodos

+0

在我的web服务器中没有php.ini文件。首先,我创建它在我的公共HTML和打开xdebug? –

回答

1

如果您发送的响应有不正确html结构,你看不到调试工具栏。你应该有响应以下内容看调试工具栏:

php bin/console debug:route 

<html> 
    <head> 
    </head> 
    <body> 
    </body> 
</html> 

如果你看到404,这意味着你还没有控制器,这条路线,你可以看到你的路由或者你的服务器关闭了。您可以通过命令启动它们:

php bin/console server:run 

无论如何,您应该阅读有关错误状态代码。它将为您节省大量的时间:

https://en.wikipedia.org/wiki/List_of_HTTP_status_codes

+0

嗨,感谢您的回复。当我运行“php bin/console debug:route”时,它会在终端显示“_profiler”路由,而我的web服务器不是本地主机。它托管在a2hosting中。所以我认为“php bin/console server:run”命令不是必需的。我的模板扩展了base.html.twig,它有{%block body%} {%endblock%}所以它仍然不起作用。 –

+0

如果它是托管的,所以请尝试注释行'header('HTTP/1.0 403 Forbidden');'和'exit('您不能访问这个文件,请查看.basename(__ FILE__)。'以获取更多信息。 );'在你的'web/app_dev.php'文件中输入浏览器'your_domain_or_ip/app_dev.php' – Daniel

+0

当删除那行代码时,我可以去_profiler /路由。但仍然看不到调试工具栏。现在,当我以这种方式路由时,我可以看到错误消息“localhost/sf3/app_dev.php /” –

相关问题