當前我的網址是http://localhost/halodocnew/frontend/web/index.php?r=site%2Flogin
我想要將所有操作的名稱文件夾frontend
更改爲client
。如何在yii2中更改名稱文件夾前端和後端?
請幫我
感謝這麼多
當前我的網址是http://localhost/halodocnew/frontend/web/index.php?r=site%2Flogin
我想要將所有操作的名稱文件夾frontend
更改爲client
。如何在yii2中更改名稱文件夾前端和後端?
請幫我
感謝這麼多
對於快速的解決方案:
複製並在同一目錄下粘貼您的frontend
文件夾並將其重命名爲client
打開halodocnew\common\config\bootstrap.php
添加別名:在瀏覽器Yii::setAlias('client', dirname(dirname(__DIR__)) . '/client');
訪問: http://localhost/halodocnew/client/web/index.php
另一種解決方案:
halodocnew\environments\dev\
frontend
此文件夾中,並將其重命名爲client
。halodocnew\environments\prod\
frontend
此文件夾中,並將其重命名爲client
。halodocnew\environments\index.php
'Development' => [ 'path' => 'dev', 'setWritable' => [ 'backend/runtime', 'backend/web/assets',
'Development' => [ 'path' => 'dev', 'setWritable' => [ 'backend/runtime', 'backend/web/assets', 'client/runtime', 'client/web/assets',
做同樣上面'Production' => [ 'path' => 'prod',
進入您的項目的根目錄,然後運行php init
web
和frontend
到veiws
文件夾client
halodocnew\common\config\bootstrap.php
Yii::setAlias('client', dirname(dirname(__DIR__)) . '/client');
http://localhost/halodocnew/client/web/index.php
我不認爲這是sooper dooper解決方案,但我用這些方法= :)
訪問感謝您的幫助。 –
你試過我的解決方案嗎? –
我試過了。在我確定選擇使用.htaccess和urlManager的解決方案之後 –
你使用什麼Web服務器? –
最好的辦法是將Web服務器中的文檔根目錄指向應用程序內的「web」目錄。因爲您的項目(控制器,模型)的所有其他目錄不應該從Web –