CI框架中base_url关于[::1]的问题

2023-08-26 19:09:41 浏览数 (3)

  1. [::1]是ip6的localhost等价地址

  1. 在当今最新的CI框架中,不推荐使config/config.php下的: base_url为空,推荐是下列格式: config[‘base_url’] = ‘http://localhost/yourproject/‘;config[‘base_url’] = ‘http://www.example.com/‘; 并且以 /结尾
代码语言:javascript复制
/*
|--------------------------------------------------------------------------
| Base Site URL
|--------------------------------------------------------------------------
|
| URL to your CodeIgniter root. Typically this will be your base URL,
| WITH a trailing slash:
|
|   http://example.com/
|
| WARNING: You MUST set this value!
|
| If it is not set, then CodeIgniter will try guess the protocol and path
| your installation, but due to security concerns the hostname will be set
| to $_SERVER['SERVER_ADDR'] if available, or localhost otherwise.
| The auto-detection mechanism exists only for convenience during
| development and MUST NOT be used in production!
|
| If you need to allow multiple domains, remember that this file is still
| a PHP script and you can easily do that on your own.
|
*/
$config['base_url'] = 'http://localhost/quincy/';

否则会出现加载不出来css、js等资源

0 人点赞