0

当我尝试包含文件时出现以下错误..我已经尝试chmod 777了目录..检查了两次,路径是正确的..但错误仍然存​​在,错误是:

Warning: require(../lib/GoogleChart.php): failed to open stream: No such file or directory in /opt/lampp/htdocs/project1/admin/googlechart/examples/line_chart_full.php on line 3

Fatal error: require(): Failed opening required '../lib/GoogleChart.php' (include_path='.:/opt/lampp/lib/php') in /opt/lampp/htdocs/project1/admin/googlechart/examples/line_chart_full.php on line 3

chmod -R 777可能有问题的是我在目录上所做的权限原因

4

1 回答 1

0

您可以尝试使用从文档根目录开始的绝对路径(如果您不需要在命令行中运行脚本,因为如果脚本由 shell 启动,则不提供 $_SERVER 数组)

 require($_SERVER['DOCUMENT_ROOT'] . "/lib/GoogleChart.php";

假设lib目录位于根目录中(www.example.com/lib/GoogleChart.php)。

我会建议require_once

于 2013-05-12T08:44:33.567 回答