Heim  >  Artikel  >  Backend-Entwicklung  >  get_include_path ()的有关问题

get_include_path ()的有关问题

WBOY
WBOYOriginal
2016-06-13 13:26:56672Durchsuche

get_include_path ()的问题
请问get_include_path()到底是获取哪里的路径

我 echo get_include_path() ; //为什么输出会是 C:\php\pear

因为我经常看到 set_include_path ( get_include_path () . PATH_SEPARATOR . $path); 
却不知道为什么里面要加 get_include_path() 这个函数 而不是直接写成如下 
set_include_path ($path);

其实最主要是 我不明白 get_include_path() ;的涵意 


------解决方案--------------------
include_path php 搜索路径

get_include_path() 返回的是当前 include_path 的值
通常就是 php.ini 中 include_path 的值

PATH_SEPARATOR include_path 分节符:windows ; linux :

set_include_path 设置 include_path
如不附加 get_include_path() 也是可以的,只是范围不同而已。不过也别抱怨:原来可运行的程序不能用了
------解决方案--------------------
set_include_path ( get_include_path () . PATH_SEPARATOR . $path);

这样写之后,再include文件,路径是相对与上面的,不用写绝对路径,也方便更改路径,

Stellungnahme:
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn
Vorheriger Artikel: php事宜未成功 Nächster Artikel: 正则匹配网页内容,求解多谢