Php require_once()函数无法包含函数()

Php require_once()函数无法包含函数(),php,function,include,absolute-path,document-root,Php,Function,Include,Absolute Path,Document Root,index.php <?php require_once('fr.php'); header('Location:'.abspath().directory()); ?> <?php require_once('fr.php'); header('Location:'.abspath().directory()); ?> 现在,当我转到index.php时,它给出了以下错误:- Fatal error: Call to undefined function abspa

index.php

<?php
require_once('fr.php');
header('Location:'.abspath().directory());
?>
<?php
require_once('fr.php');
header('Location:'.abspath().directory());
?>
现在,当我转到index.php时,它给出了以下错误:-

Fatal error: Call to undefined function abspath() in C:\xampp\htdocs\index.php on line 3

嘿,我所有评论的人都是对的。。。我不知道为什么会发生这种情况,但当我重新启动xampp时,它对我很好:)

这是100%正确的

index.php

<?php
require_once('fr.php');
header('Location:'.abspath().directory());
?>
<?php
require_once('fr.php');
header('Location:'.abspath().directory());
?>

这看起来不错。您是否1000%确定所有文件都是正确且最新的?您的要求与文档相关。functions.php是否与index.php和fr.php位于同一位置?此函数不在您尝试导入的this.php中。或者你的订单包括不好。首先你必须包含它,然后你才能使用它。为index.php和fr.php发布的脚本包含
我知道这不是问题。。但您正在重定向到路径,而不是url
<?php
require_once('functions.php');
?>
function abspath()
{
return $_SERVER['DOCUMENT_ROOT'];
}