请问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() ;的涵意 

解决方案 »

  1.   

    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() 也是可以的,只是范围不同而已。不过也别抱怨:原来可运行的程序不能用了
      

  2.   

    很感谢你的回答 
        我php.ini 中并没有设置include_path的值啊
        而且我在php.ini中也没有找到include_path
        
        而 我echo get_include_path(); 却是c:\php\pears
      

  3.   

    ;;;;;;;;;;;;;;;;;;;;;;;;;
    ; Paths and Directories ;
    ;;;;;;;;;;;;;;;;;;;;;;;;;; UNIX: "/path1:/path2"
    ;include_path = ".:/php/includes"
    ;
    ; Windows: "\path1;\path2"
    ;include_path = ".;c:\php\includes"
    如果你没有设置,则去 php 内置的默认值
      

  4.   

    非常感谢你的再次回答
        我还是不明白 我看了很多源程序都是用set_include_path ( get_include_path () . PATH_SEPARATOR . $path);这样的写法
       为什么 要这样写呢? 这样写有什么好处呢
      

  5.   

    set_include_path ( get_include_path () . PATH_SEPARATOR . $path);这样写之后,再include文件,路径是相对与上面的,不用写绝对路径,也方便更改路径,
      

  6.   

    [b]如果写成set_include_path ($path);不也是相对路径吗为什么要写成set_include_path ( get_include_path () . PATH_SEPARATOR . $path);[/b]
      

  7.   

    set_include_path是用来给get_include_path () 添加内容的,写上它我的理解是为了完整当然如果你的路径少可以不用写,当多到写的你麻木的时候就有体会了吧.