7、通过辅助设置php配置文件中的的include_path参数进行查询路径,include_path是指将要用到的包含文件所在的目录,可以将经常include文件放到一个统一的目录里,然后把这个目录设置在配置文件php.ini的include_path参数后面,在需要使用这些包含文件的时候只需要包含其名称即可,比如<?php include "metsky_cfg.php"; ?>就可以了,而实际上metsky_cfg.php文件则是存在设置的文件目录里。
附PHP.ini文件中include_path部分内容:
;;;;;;;;;;;;;;;;;;;;;;;;;
; Paths and Directories ;
;;;;;;;;;;;;;;;;;;;;;;;;;
; The root of the PHP pages, used only if nonempty.
; if PHP was not compiled with FORCE_REDIRECT, you SHOULD set doc_root
; if you are running php as a CGI under any web server (other than IIS)
; see documentation for security issues. The alternate is to use the
; cgi.force_redirect configuration below
; http://php.net/doc-root
doc_root =
; The directory under which PHP opens the script using /~username used only
; if nonempty.
; http://php.net/user-dir
user_dir =
; Directory in which the loadable extensions (modules) reside.
; http://php.net/extension-dir
; extension_dir = "./"
; On windows:
; extension_dir = "ext"
extension_dir = "D:\xampp\php\ext"