包括php文件



我目前正在使用php构建一个网站。我试图在名为User_Reg.php的文件中包含一个名为server的文件,但当我尝试刷新网站时,我得到了这个错误:

"此页面不工作。localhost当前无法处理此请求。HTTP错误500">

这是include语句。

<?php include('server.php'); ?>

我使用的是MAMP本地服务器环境。

当我删除include语句时,我的代码运行良好。

1(也许您应该使用file_exists函数来调试它

if (file_exists($filename)) {
echo "The file $filename exists";
} else {
echo "The file $filename does not exist";
}

2( 在server.php中调试代码,可能错误来自该页面/函数。

3( 此外,请尝试"./server.php">

最新更新