用户
 找回密码
 入住 CI 中国社区
搜索
查看: 1927|回复: 4
收起左侧

[版本 3.x] CI 3.0.3 正式版的bash_url()有BUG,会导致引用CSS JS等静态资源失败

[复制链接]
发表于 2015-11-3 17:59:48 | 显示全部楼层 |阅读模式
CI 3.0.3 正式版的bash_url()有BUG,会导致引用CSS JS等静态资源失败

例如:
虚拟主机设置 www.test.com
里面用bash_url().'/static/css/xxx.css'
这是会变成 http://本机IP/static/css/xxx.css

目前只有3.0正式分支有这个问题
dev和2.0正式分支没问题
目前看只有3.0正式分支需要配置 base_url

我已在github里提了 貌似老外们没听懂
https://github.com/bcit-ci/CodeIgniter/issues/4209
发表于 2015-11-4 10:35:16 | 显示全部楼层
3.0.3之后base_url()貌似是必须要配置的,这个挺麻烦的!
发表于 2015-11-4 10:36:17 | 显示全部楼层
|--------------------------------------------------------------------------
| 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'] = '';
发表于 2015-11-18 23:25:36 | 显示全部楼层
是必需配置,虽然问题不大,但是不知道这么改的意义是什么,还是3.0.2的方便。。。

发表于 2015-11-27 17:03:46 | 显示全部楼层
这样的,我都直接写到constants文件中,直接define HOST为主站地址

本版积分规则