PHP include_path Setup tips sharing _php Tutorial

Source: Internet
Author: User
The meaning of 1.include_path

When the function include (), require (), Fopen_with_path () function to find the file. When you do not set include_path, these functions open files by default when you look for them in the Web root directory. When setting the Include_ After path, these php functions are searched for under the specified include_path directory.

The principle is similar to the environment variables of the window System, when window runs the cmd command, the system will search for the existence of these commands in the environment variables they set, and then it can be executed.


Settings for 2.include_path
The first method:

Modify the Include_path entry in the php.ini file.

include_path =.:/ Usr/local/lib/php:./include
A second method:

Use the Ini_set method.
Ini_set ("Include_path", ".:.. /:./include:.. /include ");

3. Note
Zendframework include settings index.php

Copy CodeThe code is as follows:
Set_include_path ('. '). Path_separator. /library/'
. Path_separator. '. /application/models/'
. Path_separator. '. /application/lib/'
. Path_separator.get_include_path ());

Path_separator is a constant, in the Linux system is a ":" Number, Windows is a ";" No.

Therefore, it is better to write a program with a constant path_separator instead, or if the system from Linux to the win system or the reverse migration will be wrong!
Get_include_path gets the current environment variable, plus the previous setting is the new system include

http://www.bkjia.com/PHPjc/323708.html www.bkjia.com true http://www.bkjia.com/PHPjc/323708.html techarticle the meaning of 1.include_path is when the function include (), require (), Fopen_with_path () function to find the file. When you do not set the include_path, these functions default when you open the file ...

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.