site_url()和base_url()之间有什么区别? [英] what is the difference between site_url() and base_url()?

查看:158
本文介绍了site_url()和base_url()之间有什么区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

正如我在某些资源中读到的,中的 base_url() site_url() c> codeigniter 几乎是相同的,虽然我的版本的codeigniter(2.1.3)没有一个site_url()在它的config.php文件(在config目录)。

As I have read in some resources, base_url() and site_url() functions in codeigniter are almost the same, although my version of codeigniter (2.1.3) does not have a site_url() in it's config.php file (in config directory).

但是它们之间有什么区别,因为我看到了带有参数的site_url()和从未见过base_url()持有任何?

Yet are there differences between them in any way since I have seen site_url() with parameters and never seen base_url() holding any?

推荐答案

echo base_url(); // http://example.com/website
echo site_url(); // http://example.com/website/index.php

(例如css,js,image),请使用 base_url(),否则 site_url()更好。

if you want a URL access to a resource (such as css, js, image), use base_url(), otherwise, site_url() is better.

这篇关于site_url()和base_url()之间有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆