Home > php教程 > php手册 > body text

CI框架中site_url()和base_url()的区别,site_urlbase_url

WBOY
Release: 2016-06-13 09:17:21
Original
964 people have browsed it

CI框架中site_url()和base_url()的区别,site_urlbase_url

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

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

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

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

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

http://domain.com/index.php/news/php/2

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

http://domain.com/news/php2

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

以上文字很简单,小伙伴们是否了解了CI框架中site_url()和base_url()的区别了呢,有疑问就请留言吧。

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!