site_url 生成URL的问题
本地搭的CI框架,加载了一下URL辅助函数,本地链接访问:http://localhost/CodeIgniter-3.0.6/index.php/Index/index 打印site_url生成的链接:http://127.0.0.1/CodeIgniter-3.0.6/index.php/Index/index2(有时会是http://[::1]/CodeIgniter-3.0.6/index.php/Index/index2)导致ajax时有跨域的问题,如果访问链接是http://127.0.0.1/CodeIgniter-3.0.6/index.php/Index/index 就不会有问题,怎么解决? 我的base_url也出现这个问题了,找不到解决方法 我也遇到同样的问题site_url()生成http://[::1]/而不是localhost,不知道是什么原因造成的 $config['base_url'] = is_cli() ? '' : 'http://' . $_SERVER['HTTP_HOST'] . '/'; 设置base_url为“http://localhost/CodeIgniter-3.0.6/”之类的.....这样是可以运行的,不知道对不对 修改核心文件内system/core/config.php的SERVER_ADD为HTTP_HOST即可返回localhost {:1_1:}同样遇到了问题,有人解释一下吗?
<a href="http://[::1]/index.php/news/hello slug!">View article</a> combook 发表于 2016-5-24 11:27
修改核心文件内system/core/config.php的SERVER_ADD为HTTP_HOST即可返回localhost
为什么会产生这个问题呢? geek_kk 发表于 2018-4-13 14:20
同样遇到了问题,有人解释一下吗?
View article
你需要去设置 site_url 这个配置项,CI 唯一需要配置的地方。
页:
[1]