php – Symfony 2 web目录重命名

前端之家收集整理的这篇文章主要介绍了php – Symfony 2 web目录重命名前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我有一个Symfony 2项目,由于某些原因我无法重命名web目录.我试图将其重命名为public.

根据手册,我想更改composer.json并确保app.PHP和app_dev.PHP中的链接是正确的.

但是,当我运行app / console服务器时:运行,它显示

The given document root directory "C:/xampp/htdocs/xxx/app/../web" does nto exists.

我已经更改了composer.json,运行composer install和composer update但仍然没有运气.这是我的composer.json,你可以看到我已经在文件添加了“symfony-web-dir”:“public”.

如果我将我的公共文件重命名为web,那么一切都很好,但由于某些原因我不能这样做.

{
"name": "symfony/framework-standard-edition","license": "MIT","type": "project","description": "The \"Symfony Standard Edition\" distribution","autoload": {
    "psr-0": { "": "src/" }
},"require": {
    "PHP": ">=5.3.3","symfony/symfony": "~2.4","doctrine/orm": "~2.2,>=2.2.3","doctrine/doctrine-bundle": "~1.2","twig/extensions": "~1.0","symfony/assetic-bundle": "~2.3","symfony/swiftmailer-bundle": "~2.3","symfony/monolog-bundle": "~2.4","sensio/distribution-bundle": "~2.3","sensio/framework-extra-bundle": "~3.0","sensio/generator-bundle": "~2.3","incenteev/composer-parameter-handler": "~2.0","richsage/rms-push-notifications-bundle": "dev-master","friendsofsymfony/user-bundle": "~1.3","ircmaxell/password-compat": "~1.0.3"
},"scripts": {
    "post-install-cmd": [
        "Incenteev\\ParameterHandler\\ScriptHandler::buildParameters","Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap","Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache","Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets","Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile"
    ],"post-update-cmd": [
        "Incenteev\\ParameterHandler\\ScriptHandler::buildParameters","Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile"
    ]
},"config": {
    "bin-dir": "bin"
},"extra": {
    "symfony-app-dir": "app","symfony-web-dir": "public","incenteev-parameters": {
        "file": "app/config/parameters.yml"
    },"branch-alias": {
        "dev-master": "2.4-dev"
    }
}

}

您确实可以更改“web”目录的名称,但server:run命令不会发生这种情况.正如您在ServerRunCommand源代码( on line 77)中看到的那样,’web’目录在那里是硬编码的.

但是,您应该能够通过在运行命令时提供–docroot选项来解决此问题:

bin/console server:run --docroot=C:/xampp/htdocs/xxx/public

(将bin / console替换为控制台的位置,如果您使用的是Symfony 2结构,则可能是app / console)

原文链接:https://www.f2er.com/php/134585.html

猜你在找的PHP相关文章