好吧未定义功能,这是我的代码是什么样子呼叫从另一个php文件
的index.php
require_once($WebsiteRoot . "/include/testfile.php");
TestFunction();
/include/testfile.php
function TestFunction()
{
echo "It Works";
}
它给我的错误:
Fatal error:
Call to undefined function TestFunction() in /path/index.php on line 49
任何想法我做错了什么? 谢谢
给出这些信息的唯一解释是你没有包含你认为你包含的文件。 – JJJ
'echo $ WebsiteRoot。 “/include/testfile.php”;'你看到了什么? – Sampson
如果您的index.php托管在与include文件夹相同的文件结构级别上,则不需要$ WebisteRoot变量。我想这个错误来自于此。 – nullpointr