set_include_path和get_include_path使用及注意事项
2018-10-12 14:06
627 查看
set_include_path 设置默认包含路径
在include或require文件的时候,先在默认包含路径里面找,然后在同目录下找
例:
D:/xampp/htdocs/test/include 下有一文件为cls.mysqli.php
D:/xampp/htdocs/test/ 下有一文件为set_include_path.php
里面的内容为
在include或require文件的时候,先在默认包含路径里面找,然后在同目录下找
例:
D:/xampp/htdocs/test/include 下有一文件为cls.mysqli.php
D:/xampp/htdocs/test/ 下有一文件为set_include_path.php
里面的内容为
set_include_path('/xampp/htdocs/test/include'); //请注意php里边的'/'代表的不是网站根目录,而是文件所在的盘符,可用echo realpath('/');查看
//若php版本过低,该函数不支持,可用通用版ini_set()
/*查看真实默认包含路径*/
echo realpath(get_include_path());
/*要包含cls.mysqli.php只需要*/
require_once('cls.mysqli.php');
$mysql = new Mysql('localhost','root','','test'); //实例化和之后的查询语句并无错误
您可能感兴趣的文章:
- 浅谈ASP.NET的include的使用方法
- jsp include引用非本级目录网页实现代码
- c++ #include是怎么样工作的?
- php中echo()和print()、require()和include()等易混淆函数的区别
- ASP中Server.Execute和Execute实现动态包含(include)脚本的区别
- DISCUZ在win2003环境下 Unable to access ./include/common.inc.php in... 的问题终极解决方案
- PHP include_path设置技巧分享
- 让Apache支持shtml实现include文件解析的配置方法
- 从php核心代码分析require和include的区别
- 深入理解PHP之require/include顺序 推荐
- smarty模板嵌套之include与fetch性能测试
- JS实现完美include加载功能代码
- php include加载文件两种方式效率比较
- JS 实现完美include载入实现代码
- asp.net服务器端指令include的使用及优势介绍
相关文章推荐
- set_include_path和get_include_path使用及注意事项
- set_include_path, get_include_path 使用
- ServletContext.getRealPath() 使用方法及注意事项
- GetLastError与SetLastError的使用和注意事项
- GetLastError与SetLastError的使用和注意事项
- CFileDialog使用注意事项GetFileName()和GetPathName();
- PHP--set_include_path和get_include_path用法详解
- SE_queryinfo_set_where_clause和SE_queryinfo_set_dynamic_bind使用注意事项
- Qt中设置widget背景颜色/图片的注意事项(使用样式表 setStyleSheet())
- Swing getSource() 使用的注意事项
- property_get使用注意事项
- Android中include标签的使用及注意事项
- 使用class.getClassLoader().getResource("")的注意事项
- 使用 get post 注意事项
- set_include_path和get_incl…
- set_include_path, get_include_path
- GetProcAddress 使用注意事项
- Qt中设置widget背景颜色/图片的注意事项(使用样式表 setStyleSheet())
- android 中 setTextColor 方法使用注意事项
- 设置include和require的目录get_include_path与set_include_path