PHP脚本中include文件出错解决方法

yipeiwu_com6年前PHP代码库
1. 出现“未找到文件“类似的错误时候,检查include文件的位置是否正确,下面引用php手册页面的原话:
Files for including are first looked in include_path relative to the current working directory and then in the directory of the current script. E.g. if your include_path is libraries, current working directory is /www/, you included include/a.php and there is include "b.php" in that file, b.php is first looked in /www/libraries/ and then in /www/include/. If filename begins with ./ or ../, it is looked only in include_path relative to the current working directory.
2. 当出现permission deny 类似错误的时候,按以下方法排除
a) 检测被包含的文件读权限是否打开
b) 检测被包含的文件路径上的每个目录的x权限是否打开,该权限决定了目录能否被浏览。

相关文章

PHP获取路径和目录的方法总结【必看篇】

PHP获取路径和目录的方法总结【必看篇】

PHP获取目录和的方法通过魔术变量;通过超级全局变量;通过相关函数等等: <?php /** * PHP获取路径或目录实现 */ //魔术变量,获取当前文件...

php求圆周率的简单实现方法 原创

本文实例讲述了php求圆周率的简单实现方法。分享给大家供大家参考,具体如下: 前面一篇《C语言求圆周率》给出了一个圆周率的简单计算方法,这里借鉴前面的代码给出php求圆周率的运算方法。具...

PHP使用CURL实现下载文件功能示例

本文实例讲述了PHP使用CURL实现下载文件功能。分享给大家供大家参考,具体如下: 如果使用CURL下载从微信手机端上传的图片?参考下面代码 /** * CURL下载文件 成功返回...

PHP编程计算文件或数组中单词出现频率的方法

本文实例讲述了PHP编程计算文件或数组中单词出现频率的方法。分享给大家供大家参考,具体如下: 如果是小文件,可以一次性读入到数组中,使用方便的数组计数函数进行词频统计(假设文件中内容都是...

php 分库分表hash算法

复制代码 代码如下://分库分表算法 function calc_hash_db($u, $s = 4) { $h = sprintf("%u", crc32($u)); $h1 = i...