简体   繁体   English

symfony2调试工具栏无法加载

[英]symfony2 debug toolbar doesn't load

the debug toolbar doesn't load when i use this code for the controller but the website loads correctly and i don't get any errors in the log. 当我将此代码用于控制器时,调试工具栏不会加载,但网站正确加载,并且日志中没有任何错误。

function indexAction(){
        //this configures the $html which is global works correctly
        include "/index.php";

        $response = new Response();     
        $response->setContent( $html );
        $response->setStatusCode(Response::HTTP_OK);
        $response->headers->set('Content-Type','text/html');
        return $response;
}

but it does work when i use this arbitrary piece of code instead 但是当我使用这段任意代码代替时它确实起作用

function indexAction(){
        $bar = "<html><body>foo : random piece of text</body></html>";
        $response = new Response();

        $response->setContent($bar);
        $response->setStatusCode(Response::HTTP_OK);
        $response->headers->set('Content-Type','text/html');
        return $response;
}

I have realised that when i use the first code i don't get a route match for _wdt in the logs.where could the problem be? 我已经意识到,当我使用第一个代码时,日志中没有_wdt的路由匹配。问题出在哪里?

update: if i remove the body tags from $bar like such: 更新:如果我从$ bar删除body标签,例如:

  $bar = "<html>foo: random piece of text</html>"

it won't work either.i think it has something to do with the page not being properly HTML tagged as stated in the eventlistener documentation in symfony2.but i know my page is properly tagged.also looked at the source after the page loas in the browser.so what's the problem here? 它也无法正常工作。我认为这与页面未按symfony2中的eventlistener文档中所述正确地标记HTML有关,但我知道我的页面已正确标记。那是什么问题呢?

问题已解决:我正在加载的页面中的HTML标记包含空格,例如:而不是,并且侦听器似乎没有检测到。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM