CI中site_url()和base_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


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM