在 config/application.php 中,只需将静态 url 或空的 URL 更改为以下
它为您和您正在使用的应用程序功能(如重定向)检测正确的 url
<?php
if (empty($_SERVER['SCRIPT_NAME']) || $_SERVER['SCRIPT_NAME'] == "artisan") {
$url = 'http://www.mydomain.com';
} else {
$url = 'http://' . $_SERVER['HTTP_HOST'] . str_replace('/index.php', '', $_SERVER['SCRIPT_NAME']);
}
return array(
/*
|--------------------------------------------------------------------------
| Application URL
|--------------------------------------------------------------------------
|
| The URL used to access your application without a trailing slash. The URL
| does not have to be set. If it isn't, we'll try our best to guess the URL
| of your application.
|
*/
'url' => $url,
并将文件的其余部分保持原样