2013-10-21 83 views
0

我正在使用項目symfony版本2.3.6專門。問題是,我在代碼中進行了更改,但更改並未反映在頁面上,直到頁面充電多次。我在開發環境。就好像每次加載頁面時都不會編譯代碼。你不應該在開發環境應該總是編譯?問候工作開發環境symfony2.3

謝謝你的答案。我使用MAMP和PHP 5.5.3並沒有選擇緩存。 的app_dev是:

<?php 

use Symfony\Component\HttpFoundation\Request; 
use Symfony\Component\Debug\Debug; 

// If you don't want to setup permissions the proper way, just uncomment the following PHP line 
// read http://symfony.com/doc/current/book/installation.html#configuration-and-setup for more information 
//umask(0000); 

// This check prevents access to debug front controllers that are deployed by accident to production servers. 
// Feel free to remove this, extend it, or make something more sophisticated. 
if (isset($_SERVER['HTTP_CLIENT_IP']) 
    || isset($_SERVER['HTTP_X_FORWARDED_FOR']) 
    || !in_array(@$_SERVER['REMOTE_ADDR'], array('127.0.0.1', 'fe80::1', '::1')) 
) { 
    header('HTTP/1.0 403 Forbidden'); 
    exit('You are not allowed to access this file. Check '.basename(__FILE__).' for more information.'); 
} 

$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); 

我評論線// $內核級> loadClassCache();但問題沒有解決。

+0

我敢肯定它的緩存問題 – 2013-10-21 10:54:46

+0

你有APC緩存安裝?如果是這樣嘗試禁用APC – acrobat

+0

請發佈您的web/app_dev.php文件內容 – Udan

回答

1

Symfony默認緩存所有內容,特別是Twig。我知道這很乏味。

望着手冊(http://symfony.com/doc/current/book/templating.html)它說:

如果您在新的位置添加模板,您可能需要清除 緩存(PHP應用程序/控制檯高速緩存:清除),甚至如果您處於調試模式

所以,你需要清除緩存。但注意全部刪除,因爲用戶會話存儲在/cache/dev/sessions。這是另一個強大的限制:Symfony2需要一個可寫的文件系統。

有根本的解決辦法,但你的應用程序可以得到很慢,也開發模式:

twig: 
    cache: false 

在你config.yml

+0

感謝您解答Fabio,立即更改模板枝視圖結果,但是驅動程序中的任何更改並清除緩存rm -rf應用程序/緩存仍不會更新更改直到20秒或30秒後 – user2799505

+2

問題在於php 5.5.3安裝opcache我禁用opcache我工作正常。謝謝。 – user2799505