[英]symfony2 debug toolbar doesn't load
当我将此代码用于控制器时,调试工具栏不会加载,但网站正确加载,并且日志中没有任何错误。
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;
}
但是当我使用这段任意代码代替时它确实起作用
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;
}
我已经意识到,当我使用第一个代码时,日志中没有_wdt的路由匹配。问题出在哪里?
更新:如果我从$ bar删除body标签,例如:
$bar = "<html>foo: random piece of text</html>"
它也无法正常工作。我认为这与页面未按symfony2中的eventlistener文档中所述正确地标记HTML有关,但我知道我的页面已正确标记。那是什么问题呢?
问题已解决:我正在加载的页面中的HTML标记包含空格,例如:而不是,并且侦听器似乎没有检测到。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.