0
爲什麼route('charts.inline', 123123)
返回http://localhost/charts/123123
而不是我的實際域?我的ENV配置/ app.php網址設置正確,我的ENV是正確的。我正在通過終端[一個'命令']運行這個命令。Laravel - 返回localhost的路由
想法?
爲什麼route('charts.inline', 123123)
返回http://localhost/charts/123123
而不是我的實際域?我的ENV配置/ app.php網址設置正確,我的ENV是正確的。我正在通過終端[一個'命令']運行這個命令。Laravel - 返回localhost的路由
想法?
你已經回答了自己的問題:
我當你從終端中運行運行此表彰通過終端[一個「命令」]
,沒有主機名將被計算出來,因此該框架假設爲localhost
作爲默認值。
如果要設置默認的域名由命令行中運行代碼時能正常工作,然後去你config/app.php
文件並更改以下的設置:
/*
|--------------------------------------------------------------------------
| Application URL
|--------------------------------------------------------------------------
|
| This URL is used by the console to properly generate URLs when using
| the Artisan command line tool. You should set this to the root of
| your application so that it is used when running Artisan tasks.
|
*/
'url' => 'http://localhost',
到
'url' => 'http://yourdomain.com',
我剛剛在Laravel 5上測試了這個過程,但我希望它在Laravel 4上也能正常工作。
你使用xampp還是wamp? – 2014-09-04 03:54:52
沒有先生。而nginx也有正確的服務器名稱,所以這不是問題... – michaelcurry 2014-09-04 21:07:10