PHP include_path Setup tips for sharing _php tips

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

When the function include (), require (), Fopen_with_path () function to find the file. Without setting the include_path, these functions are found by default in the Web root directory when they open files. When setting up Include_ Path, these php functions are searched for under the specified include_path directory first.

Its Principle and window system environment variable similar, when the window runs cmd command, input some cmd command after the system will be in its set environment variables to search for the existence of these commands, exist can be executed.


Settings for 2.include_path
The first method:

Modify the Include_path item 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 Code code 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 that is a ":" Number in a Linux system and a ";" on Windows. Resolution

Therefore, it is best to write the program with constant Path_separator instead, otherwise if the system from Linux to the win system or transplant to the reverse will be wrong!
Get_include_path gets the current existing environment variable, plus the previous setting is the new system include

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.