2014-02-08 84 views
1

調試工具欄不會加載,當我使用此代碼的控制器,但網站加載正確,我沒有得到任何錯誤的日誌。symfony2調試工具欄不加載

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 = "<html>foo: random piece of text</html>" 

它不會工作either.i認爲它是與不是正確的頁面HTML標記爲在規定symfony2中的eventlistener文檔。但是我知道我的頁面已經被正確地標記了。也查看了瀏覽器中頁面loas後的源代碼。那麼這裏有什麼問題?

+0

對於正確詢問的問題+1。不幸的是,我無法幫助 – hek2mgl

回答

0

問題解決:我加載的頁面中的HTML標籤包含空格,例如:而不是,並且它顯示監聽器沒有檢測到。