为什么route('charts.inline', 123123)返回http://localhost/charts/123123而不是我的实际域?我的 ENV config/app.php url 设置正确,我的 ENV 是正确的。我正在通过终端 [a 'command'] 运行此命令。
想法?
您已经回答了自己的问题:
我正在通过终端运行此命令 [a 'command']
当您从终端运行时,不需要确定主机名,因此框架假定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',
Run Code Online (Sandbox Code Playgroud)
到
'url' => 'http://yourdomain.com',
Run Code Online (Sandbox Code Playgroud)
我刚刚在 Laravel 5 上测试了这个程序,但我希望它也适用于 Laravel 4。
| 归档时间: |
|
| 查看次数: |
5727 次 |
| 最近记录: |