我注意到如果我更改了源代码,它会影响生产环境。这种行为正常吗?
我想在文件更改时重新生成缓存应该只发生在开发环境中,并且对源代码的更改不应该应用于产品缓存。
这是我的 app.php 文件:
use Symfony\Component\ClassLoader\ApcClassLoader;
use Symfony\Component\HttpFoundation\Request;
$loader = require_once __DIR__.'/../app/bootstrap.php.cache';
require_once __DIR__.'/../app/AppKernel.php';
$kernel = new AppKernel('prod', false);
$kernel->loadClassCache();
Request::enableHttpMethodParameterOverride();
$request = Request::createFromGlobals();
$response = $kernel->handle($request);
$response->send();
$kernel->terminate($request, $response);
这是我的 config_prod.yml
imports:
- { resource: config.yml }
framework:
router:
strict_requirements: null
和 config.yml :
imports:
- { resource: parameters.yml }
- { resource: security.yml }
- { resource: databases.yml }
framework:
translator: { fallback: %locale% }
secret: %secret%
router:
resource: "%kernel.root_dir%/config/routing.yml"
strict_requirements: %kernel.debug%
form: ~
csrf_protection: ~
validation: { enable_annotations: true }
templating:
engines: ['twig','php']
#assets_version: SomeVersionScheme
default_locale: "%locale%"
trusted_proxies: ~
session: ~
fragments: ~
# Twig Configuration
twig:
debug: %kernel.debug%
strict_variables: %kernel.debug%
我用这个命令清除缓存:
app/console cache:clear --env=prod --no-debug