PHP致命错误:require():无法打开所需的'rep registration.php'

时间:2013-11-24 10:03:55

标签: php require

我收到以下错误消息:

[24-Nov-2013 10:59:00 Europe / Stockholm] PHP致命错误:require():无法打开所需的'repregisration.php'(include_path ='。:/ Applications / MAMP / bin /第46行/Applications/MAMP/htdocs/reg4event/register.php中的php / php5.4.10 / lib / php')

脚本 register.php 如下所示第46行

// 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();
}
?>

为什么会收到错误消息?

2 个答案:

答案 0 :(得分:2)

您的文件名是repregistration.php但是您的文件名包括require "repregisration.php"; - 您的包含行中存在拼写错误。

答案 1 :(得分:0)

无法找到该文件。尝试使用require_once('...');并尝试使用完全限定路径。 How to include PHP files that require an absolute path?

它只是查找文件的错误位置。