我一直在尝试找到如何在Symfony 2中重命名应用程序文件夹,但找不到任何东西。我认为这是可行的,但我不知道该怎么做。
有谁能够帮助我?
查看您的composer.json
文件。具体来说:
"extra": {
"symfony-app-dir": "app",
"symfony-web-dir": "web",
"symfony-assets-install": "relative",
"incenteev-parameters": {
"file": "app/config/parameters.yml"
}
}
更改symfony-app-dir
为所需的值。您还必须更改该路径incenteev-parameters.file
以及可能明确指向该app
目录的其他任何路径。
然后...您将需要相应地更改web/app.php
和web/app_dev.php
文件中的某些路径。例如:
<?php
use Symfony\Component\ClassLoader\ApcClassLoader;
use Symfony\Component\HttpFoundation\Request;
$loader = require_once __DIR__.'/../apps/bootstrap.php.cache';
// Enable APC for autoloading to improve performance.
// You should change the ApcClassLoader first argument to a unique prefix
// in order to prevent cache key conflicts with other applications
// also using APC.
/*
$apcLoader = new ApcClassLoader(sha1(__FILE__), $loader);
$loader->unregister();
$apcLoader->register(true);
*/
require_once __DIR__.'/../apps/AppKernel.php';
//require_once __DIR__.'/../apps/AppCache.php';
$kernel = new AppKernel('prod', false);
$kernel->loadClassCache();
//$kernel = new AppCache($kernel);
// When using the HttpCache, you need to call the method in your front controller instead of relying on the configuration parameter
//Request::enableHttpMethodParameterOverride();
$request = Request::createFromGlobals();
$response = $kernel->handle($request);
$response->send();
$kernel->terminate($request, $response);
该$loader
和require_once
路径将不得不改变。我假设可能需要清除缓存并更新作曲家。
那应该工作正常。该文档讨论了覆盖默认文件结构的问题,但未说明任何有关app
目录的信息。但是,我在这里进行了快速测试,在这里似乎工作正常。YMMV!
希望这可以帮助 :)
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句