Home >Backend Development >PHP Tutorial >The difference between set_include_path under win and linux

The difference between set_include_path under win and linux

WBOY
WBOYOriginal
2016-07-29 08:37:26889browse

I just adjusted the program, and the program that was working fine on the server actually went wrong under win.
After careful debugging, I found out that it was a problem with set_include_path.
Under win, when you want to include multiple paths, you have to separate them with ";", but under Linux, use ":" to separate them. .
The include path setting in Zendframe 2007-06-29 11:55 The include_path in the ZF example is not good and will destroy the existing settings, so I feel that it is better to set it like this:
//Include Path setting
set_include_path(get_include_path () . PATH_SEPARATOR . __APP_ROOT_PATH__ . 'Library' . DIRECTORY_SEPARATOR . 'ZF' . DIRECTORY_SEPARATOR);
require 'Zend/Loader.php';
get_include_path() is to get the current inc_path of the system.
__APP _ROOT_PATH__ is one I set myself Constant, represents the current directory.
PATH_SEPARATOR This needs to be mentioned, because the path under WIN is separated by ; (semicolon), but under LINUX it is separated by : (colon), so this constant is used. Represents separator.
After setting like this, it can be used under both WIN and LINUX.

The above introduces the difference between set_include_path under win and Linux, including the relevant content. I hope it will be helpful to friends who are interested in PHP tutorials.

Statement:
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