dongliu5475 2013-09-22 03:24
浏览 37
已采纳

无法在网站上显示Symfony 2工具栏

I am trying to do this from a remote computer so the app_dev.php is:

<?php
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Debug\Debug;
$loader = require_once __DIR__.'/../app/bootstrap.php.cache';
Debug::enable();
require_once __DIR__.'/../app/AppKernel.php';
$kernel = new AppKernel('dev', true);
$kernel->loadClassCache();
$request = Request::createFromGlobals();
$response = $kernel->handle($request);
$response->send();
$kernel->terminate($request, $response);

After the template renders I get this:

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <title>Title</title>
  </head>
  <body>
      <h1>Give us a toolbar now will you?</h1>
  </body>
</html>

Looks like valid html and has a body element but no tool bar is there.

I have only ftp access so renamed the Symfony/app/cache folder to gone.

I have confirmed that app_dev.php executes Debug::enable(); and $kernel = new AppKernel('dev', true); (adding an error there causes an error.

I have confirmed that valid html is produced rendering index.html.twig (not a cached one). I have renamed the cache directory.

Not sure what else to check to have it show the tool bar.

  • 写回答

1条回答 默认 最新

  • dougan0529 2013-09-22 12:23
    关注

    You must enable the profiler in AppKernel.php

    public function registerBundles()
    {
        $bundles = ...
    
        if (in_array($this->getEnvironment(), array('dev', 'test'))) {
            $bundles[] = new Symfony\Bundle\WebProfilerBundle\WebProfilerBundle();
            ...
        }
    
        return $bundles;
    }
    

    And make sure that you have JavaScript enabled.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 matlab中使用gurobi时报错
  • ¥15 WPF 大屏看板表格背景图片设置
  • ¥15 这个主板怎么能扩出一两个sata口
  • ¥15 不是,这到底错哪儿了😭
  • ¥15 2020长安杯与连接网探
  • ¥15 关于#matlab#的问题:在模糊控制器中选出线路信息,在simulink中根据线路信息生成速度时间目标曲线(初速度为20m/s,15秒后减为0的速度时间图像)我想问线路信息是什么
  • ¥15 banner广告展示设置多少时间不怎么会消耗用户价值
  • ¥16 mybatis的代理对象无法通过@Autowired装填
  • ¥15 可见光定位matlab仿真
  • ¥15 arduino 四自由度机械臂