gpt4 book ai didi

php - Symfony 2 网页目录重命名

转载 作者:可可西里 更新时间:2023-10-31 23:07:20 25 4
gpt4 key购买 nike

我有一个 Symfony 2 项目,由于某些原因我无法重命名网络目录。我正在尝试将其重命名为 public。

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

但是当我运行 app/console server:run 时,它显示

 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"添加到文件中。

如果我将我的公共(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::buildBootstrap",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets",
"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)

关于php - Symfony 2 网页目录重命名,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27810411/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com