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