PHP CI框架学习

CI框架的URL辅助函数使用

URL 辅助函数文件包含一些在处理 URL 中很有用的函数

加载辅助函数

在使用CI框架的使用经常碰到跳转和路径方面的问题,site_url()和base_url()很容易混淆,下面来说说他们的区别!

假如你config文件里面的base_url和index_page是这样定义的:

config['base_url'] = "http://ci.com/ci_article";

config['index_page'] = "index.php";

那么你若使用site_url("news/php/2");则实际url为

http://ci.com/ci_article/index.php/news/php/2

若使用base_url("news/php/2");则url为:

http://ci.com/ci_article/news/php2

发现没有,base_url()少了一个index.php

猜你喜欢

转载自www.cnblogs.com/bkwxx/p/9987832.html
今日推荐