CodeIgniter网站网址和基本网址之间的差异 [英] Difference betwwen CodeIgniter Site Url and base Url

查看:106
本文介绍了CodeIgniter网站网址和基本网址之间的差异的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Hello SiteUrl()和BaseUrl()
之间有什么区别?
在我以前的项目是基地url,但现在在我的新项目是Siteurl。为什么会这样?
是baseurl()是一个过时的

Hello What is the difference between SiteUrl() and BaseUrl() ? In my previous project it is base url but now in my new project it is Siteurl.Why this happens? Is baseurl() is an outdated one

推荐答案

清除所有你的疑问你必须阅读CodeIgniter手册。 a href =http://ellislab.com/codeigniter%20/user-guide/helpers/url_helper.html =nofollow>请按此

To clear all your doubts you have to read CodeIgniter Manual.Please Click Here

基本网址

base URL


在你的配置文件。示例:
echo base_url();

Returns your site base URL, as specified in your config file. Example: echo base_url();

此函数返回与site_url相同的内容,而不附加
index_page或url_suffix。

This function returns the same thing as site_url, without the index_page or url_suffix being appended.

也像site_url一样,您可以以字符串或数组形式提供段。
下面是一个字符串示例:echo base_url(blog / post / 123);

Also like site_url, you can supply segments as a string or an array. Here is a string example: echo base_url("blog/post/123");

>网站网址

site URL


返回您的配置文件中指定的网站网址。 index.php
文件(或者您在config
文件中设置为您的网站index_page的任何内容)都将添加到URL中,将任何URI段传递给
函数,以及您的配置文件中设置的url_suffix。

Returns your site URL, as specified in your config file. The index.php file (or whatever you have set as your site index_page in your config file) will be added to the URL, as will any URI segments you pass to the function, and the url_suffix as set in your config file.

您可以随时使用此函数生成
a本地网址,在您的
网址更改的情况下可移植。

You are encouraged to use this function any time you need to generate a local URL so that your pages become more portable in the event your URL changes.

段可以选择作为字符串或
数组传递到函数。这里是一个字符串示例:echo site_url(news / local / 123);

Segments can be optionally passed to the function as a string or an array. Here is a string example: echo site_url("news/local/123");

上面的例子将返回如下:
http://example.com/index.php/news/local/123

The above example would return something like: http://example.com/index.php/news/local/123

下面是作为数组传递的段的示例:$ segments =
array('news','local','123');

Here is an example of segments passed as an array: $segments = array('news', 'local', '123');

echo site_url($ segments);

echo site_url($segments);

这篇关于CodeIgniter网站网址和基本网址之间的差异的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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