set_include_path & get_include_path
2012-07-31 20:30
225 查看
set_include_path(get_include_path() . PATH_SEPARATOR . $path); 是包含路径;
比如你有一个文件夹:命名为include,里面有
数据库连接文件:conn.php……,
你这样设置:set_include_path("/include")
那么以后你就直接可以在其他页面中使用
include("conn.php")
PATH_SEPARATOR 表示路径分隔符,linux下是冒号(:),windows下是分号(;)
set_include_path(get_include_path() . PATH_SEPARATOR .
__TYPECHO_ROOT_DIR__ . '/var' . PATH_SEPARATOR .
__TYPECHO_ROOT_DIR__ . __TYPECHO_PLUGIN_DIR__);
什意思呢,举个例子:
你的一个页面有这样的语句:
include('/inc/sql.php');
include('/inc/conn.php');
而你突然发现我把这些要包含的文件放在inc目录下不安全,怎么办,要改,我想放到include目录中,好的,这么多页面不累死才怪:有没有好的方法!有!!!!!!!
我在config.inc.php中写着么一句:
set_include_path(get_include_path() .'/include')就这么简单,对,就这么简单!动态的修改!
get_include_path()返回包含路径,不正确返回false;
比如你有一个文件夹:命名为include,里面有
数据库连接文件:conn.php……,
你这样设置:set_include_path("/include")
那么以后你就直接可以在其他页面中使用
include("conn.php")
PATH_SEPARATOR 表示路径分隔符,linux下是冒号(:),windows下是分号(;)
set_include_path(get_include_path() . PATH_SEPARATOR .
__TYPECHO_ROOT_DIR__ . '/var' . PATH_SEPARATOR .
__TYPECHO_ROOT_DIR__ . __TYPECHO_PLUGIN_DIR__);
什意思呢,举个例子:
你的一个页面有这样的语句:
include('/inc/sql.php');
include('/inc/conn.php');
而你突然发现我把这些要包含的文件放在inc目录下不安全,怎么办,要改,我想放到include目录中,好的,这么多页面不累死才怪:有没有好的方法!有!!!!!!!
我在config.inc.php中写着么一句:
set_include_path(get_include_path() .'/include')就这么简单,对,就这么简单!动态的修改!
get_include_path()返回包含路径,不正确返回false;
相关文章推荐
- set_include_path() &&get_include_path()用法
- set_include_path和get_include_path使用及注意事项
- set_include_path和get_include_path用法详解
- set_include_path get_include_path
- php手记-set_include_path和get_include_path用法详解
- set_include_path和get_include_path用法详解
- 关于get_include_path()和set_include_path()
- 设置include和require的目录get_include_path与set_include_path
- set_include_path和get_include_path用法详解
- warning: 'includeantruntime' was not set, defaulting to build.sysclasspath=last; set to false for re
- PHP--set_include_path和get_include_path用法详解
- set_include_path和get_include_path用法详解
- php get_include_path();是干嘛的、??还有set_include_path();/?????
- php 文件路径设置 set_include_path(); get_include_path();
- set_include_path和get_include_path使用及注意事项
- set_include_path, get_include_path 使用
- set_include_path和get_include_path用法详解
- set_include_path, get_include_path
- set_include_path和get_include_path用法详解
- set_include_path和get_include_path用法详解