2017-03-02 5 views
0

WebデバッグバーをSymfony 2.8に表示しようとしていますが、何とか動作させることができません。Symfony2デバッグツールバーが挿入されていませんSymfony 2.8

私のテンプレートには終了タグがあります。またWebDebugToolbarListenerが呼び出されたが、この条件に中止します:私は、デバッグおよび「X-デバッグ・トークン」は、ヘッダーに含まれることはありませんことがわかっ

 if (self::DISABLED === $this->mode 
     || !$response->headers->has('X-Debug-Token') 
     || $response->isRedirection() 
     || ($response->headers->has('Content-Type') && false === strpos($response->headers->get('Content-Type'), 'html')) 
     || 'html' !== $request->getRequestFormat() 
     || false !== stripos($response->headers->get('Content-Disposition'), 'attachment;') 
    ) { 
     return; 
    } 

    $this->injectToolbar($response, $request); 

。そのため、injectToolbarメソッドは呼び出されません。私は特定の行|| !$response->headers->has('X-Debug-Token')ツールバーがしかし、私は例外を受け取り、現れるでしょうコメント: 『ルートの『

「パラメータ』トークンを_wdt『(』」与えられた)[^ /] ++』一致している必要があります」対応するURLを生成するには にしてください。

また、この問題を処理する方法は明らかに間違っています。

私は間違っていますか?私はアイデアがありません。 whic(

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

web_profiler: 
    toolbar: true 
    intercept_redirects: false 
    position: bottom 

//app_dev.php 
Debug::enable(); 

require_once __DIR__.'/../app/AppKernel.php'; 

$kernel = new AppKernel('dev', true); 

//AppKernel.php 
if (in_array($this->getEnvironment(), array('dev', 'test'))) { 
    $bundles[] = new Symfony\Bundle\DebugBundle\DebugBundle(); 
    $bundles[] = new Symfony\Bundle\WebProfilerBundle\WebProfilerBundle(); 
    $bundles[] = new Sensio\Bundle\DistributionBundle\SensioDistributionBundle(); 
    $bundles[] = new Sensio\Bundle\GeneratorBundle\SensioGeneratorBundle(); 
} 

#routing_dev.yml 
_wdt: 
    resource: "@WebProfilerBundle/Resources/config/routing/wdt.xml" 
    prefix: /_wdt 

_profiler: 
    resource: "@WebProfilerBundle/Resources/config/routing/profiler.xml" 
    prefix: /_profiler 

_configurator: 
    resource: "@SensioDistributionBundle/Resources/config/routing/webconfigurator.xml" 
    prefix: /_configurator 

答えて

1

をどうやら私は明示的にプロファイラを有効にする必要がありました。ここでは

は、私が設定したものですhはX-Debug-Tokenを設定します)。勝利のためのRTM。私は過去にこれをしたことはありませんでした。

キーはonly_exceptions: falseを設定します。そうしないと、プロファイラはデータを収集せず、Xデバッグトークンも設定しないので、ツールバーは接続されません。キャッシュディレクトリがかなり急速に成長しているので、私は過去にこのフラグをtrueに設定しました。

enabledフラグは、デフォルトでは、開発環境とテスト環境ではtrueに設定されています。

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

興味深い。私は2.8のバージョンは便利ではありませんが、3.2のアプリケーションは、有効にしなくてもうまく動作します:true – Cerad

+0

うん、私は間違っていました、キーは 'only_exceptions'をfalseに設定することでした:) – Atan

関連する問題