Home Backend Development PHP Tutorial CI框架中site_url()和base_url()的区别_php技巧

CI框架中site_url()和base_url()的区别_php技巧

May 16, 2016 pm 08:25 PM
ci framework

在使用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()的区别了呢,有疑问就请留言吧。

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

Hot Article Tags

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

How to use CI framework in php? How to use CI framework in php? Jun 01, 2023 am 08:48 AM

How to use CI framework in php?

How to use CI framework in PHP How to use CI framework in PHP Jun 27, 2023 pm 04:51 PM

How to use CI framework in PHP

How to use CI4 framework in php? How to use CI4 framework in php? Jun 01, 2023 pm 02:40 PM

How to use CI4 framework in php?

A guide to CI frameworks in PHP A guide to CI frameworks in PHP May 22, 2023 pm 07:10 PM

A guide to CI frameworks in PHP

How to introduce css into ci framework How to introduce css into ci framework Dec 26, 2023 pm 05:20 PM

How to introduce css into ci framework

Detailed explanation of the steps to reference CSS styles in the CI framework Detailed explanation of the steps to reference CSS styles in the CI framework Jan 16, 2024 am 09:28 AM

Detailed explanation of the steps to reference CSS styles in the CI framework

Steps to introduce CSS styles to web pages using CI framework Steps to introduce CSS styles to web pages using CI framework Jan 16, 2024 am 09:20 AM

Steps to introduce CSS styles to web pages using CI framework

How to use CI6 framework in php? How to use CI6 framework in php? Jun 01, 2023 pm 11:10 PM

How to use CI6 framework in php?

See all articles