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如何获取当前的url文件名呢? 我是这样处理的 :shock: 教...

PHP查找数值数组中不重复最大和最小的10个数的方法

本文实例讲述了PHP查找数值数组中不重复最大和最小的10个数的方法。分享给大家供大家参考。具体如下: 1. php代码如下: //随机生成1万个元素的数组 for($i=0;$i&l...

php文件操作相关类实例

本文实例讲述了php文件操作相关类。分享给大家供大家参考。具体如下: <?php class file_dir { function check_exist($...

PHP中file_put_contents追加和换行的实现方法

在PHP的一些应用中需要写日志或者记录一些信息,这样的话。可以使用fopen(),fwrite()以及 fclose()这些进行操作。也可以简单的使用file_get_contents(...

相对路径转化成绝对路径

提取 Gregarius中的一个函数。可以把网页中的相对路径自动转化成绝对路径。 <?  function relative_to_absolute(...