duandian2725 2018-11-01 09:34
浏览 103

Symfony 3.4应用程序中的bootstrap.php.cache

I am looking to confirm how my app*.php files should be configured with regards to the bootstrap.php.cache file.

I have read some conflicting advice on how to treat this file in Symfony 3.0 and above, namely https://symfonycasts.com/screencast/symfony3-upgrade/new-dir-structure#moving-bootstrap-php-cache and https://gist.github.com/mickaelandrieu/5d27a2ffafcbdd64912f549aaf2a6df9#files-to-move-update-

My understanding is that bootstrap.php.cache is required for a performance boost and is only required or recommended in the 'prod' environment. So this leaves me with the following setup:

app.php:

/** @var \Composer\Autoload\ClassLoader $loader */
$loader = require __DIR__.'/../vendor/autoload.php';
include_once __DIR__.'/../var/bootstrap.php.cache';
$kernel = new AppKernel('prod', false);

app_dev.php:

/** @var \Composer\Autoload\ClassLoader $loader */
$loader = require __DIR__.'/../vendor/autoload.php';
Debug::enable();
$kernel = new AppKernel('dev', true);

Previously $loader was /app/autoload.php, which has been moved to /vendor and /app/bootstrap.php.cache has been deleted and the DistrubutionBundle is now writing that file to /var.

Is this setup correct? (bin/console --env=dev/prod returns no errors)

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 运动想象脑电信号数据集.vhdr
    • ¥15 三因素重复测量数据R语句编写,不存在交互作用
    • ¥15 微信会员卡等级和折扣规则
    • ¥15 微信公众平台自制会员卡可以通过收款码收款码收款进行自动积分吗
    • ¥15 随身WiFi网络灯亮但是没有网络,如何解决?
    • ¥15 gdf格式的脑电数据如何处理matlab
    • ¥20 重新写的代码替换了之后运行hbuliderx就这样了
    • ¥100 监控抖音用户作品更新可以微信公众号提醒
    • ¥15 UE5 如何可以不渲染HDRIBackdrop背景
    • ¥70 2048小游戏毕设项目