PHP Fata错误:require():无法打开required';rep registration.php';
我收到以下错误消息: [24-Nov-2013 10:59:00 Europe/Stockholm]PHP致命错误:require():无法在第46行的/Applications/MAMP/htdocs/reg4event/register.PHP中打开所需的'repregistration.PHP'(include_path=.:/Applications/MAMP/bin/PHP/php5.4.10/lib/PHP) 脚本register.php如图所示,其中第46行存在:PHP Fata错误:require():无法打开required';rep registration.php';,php,require,Php,Require,我收到以下错误消息: [24-Nov-2013 10:59:00 Europe/Stockholm]PHP致命错误:require():无法在第46行的/Applications/MAMP/htdocs/reg4event/register.PHP中打开所需的'repregistration.PHP'(include_path=.:/Applications/MAMP/bin/PHP/php5.4.10/lib/PHP) 脚本register.php如图所示,其中第46行存在: // Check
// Check if SESSION is SET
if ( (isset($_SESSION["RegType"])) && (isset($_SESSION["eventId"])) ) {
// Check if it is a Rep Registration or a Guest Registration
if ( $_SESSION["RegType"] == "rep" ) {
// The Registration if of type "rep", require the repregistration script
require "repregisration.php";
} elseif ( $_SESSION["RegType"] == "guest") {
// The Registration if of type "guest", require the guestregistration script
require "/snippets/guestregistration.php";
} else {
// Neither of "rep" or "guest" was set in the $_SESSION["RegType"], hence header back to index.php page
header("Location: index.php");
exit();
}
} else {
header("Location: index.php");
}
repregistration.php文件包含以下内容:
<?php
// Check which STAGE the Rep registration process is in
if ( !isset($_SESSION["RegStage"]) ) {
// Include the Registration script
require "/pages/repform.php";
} elseif ( isset($_SESSION["RegStage"]) == "review" ) {
// Include the Review script for the registration to confirm their details
exit("RegStage Review has not been created!");
} elseif ( $_SESSION["RegStage"] == "confirmed" ) {
// Include the Confirmed information
exit("RegStage Confirmed has not been created!");
} else {
header("Location: index.php");
exit();
}
?>
为什么我会收到错误消息?它找不到文件。尝试使用
require_一次(“…”)代码>并尝试使用完全限定路径
它只是在错误的位置查找文件。您的文件名是repregistration.php
,但您的包含要求“repregistration.php”代码>-您的包含行中有拼写错误。同一目录中的所有文件?谢谢!无论我多么频繁地寻找拼写错误,我似乎总是想念它们默认情况下,系统是否不使用脚本中使用的路径以及与该路径相关的路径?通常是,但您不能指望它取决于操作系统以及脚本的运行位置。