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

[版本 3.x] 关于site_url()函数的疑问

[复制链接]
发表于 2016-4-22 17:07:48 | 显示全部楼层 |阅读模式
在代码中
PHP复制代码
<?php echo site_url('/view');?>
        <br>
        <?php echo site_url();?>
复制代码

得到结果确实这样的
http://localhost/git/myblog/index.php/view/localhost/coding/myblog
http://localhost/git/myblog/index.php。
在给site_url()函数加参数是后面莫名其妙一段,求大神指导下
 楼主| 发表于 2016-4-25 15:30:49 | 显示全部楼层
Closer 发表于 2016-4-25 10:17
問題也許出在你的 route.php 或 config.php 內的 $config['base_url']

谢谢,我找到问题了,在config.php中$config['url_suffix']有那个值,所以除了错。删除这个值就ok了
发表于 2016-4-25 10:17:58 | 显示全部楼层
問題也許出在你的 route.php 或 config.php 內的 $config['base_url']
发表于 2016-4-25 17:04:48 | 显示全部楼层
建议你用$this->config->item('base_url');
            $this->config->item('img_url');
            $this->config->item('app_url');
这样的话以后改域名之类的只在config改。而且比如项目里好几个域名地址的话。比如说,app的下载地址,img的获取地址,等等等。。。。都可以重新定义一个url   这样的操作方式无疑是最方便的.楼主可以借鉴一下

本版积分规则