我使用的CI框架
在config.php中,将:
$config['base_url'] = 'http://example.com/****';
更改为:
$config['base_url'] = 'http://example.com/****';
$baseUrl = str_replace('\\','/',dirname($_SERVER['SCRIPT_NAME']));
$baseUrl = trim($baseUrl,'/');
$baseUrl = empty($baseUrl) ? '/' : "/$baseUrl/";
if ( ! empty($_SERVER['HTTPS'])) {
$config['base_url'] = 'https://example.com/'.$baseUrl;
} else {
$config['base_url'] = 'http://example.com/'.$baseUrl;
}