Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/257.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在这个php示例中创建的类实例在哪里?_Php_Class_Login_Instance - Fatal编程技术网

在这个php示例中创建的类实例在哪里?

在这个php示例中创建的类实例在哪里?,php,class,login,instance,Php,Class,Login,Instance,我对PHP非常陌生,但已经习惯了一些其他编程语言,如JAVA、Python。最近,我仔细研究了登录脚本panique/php Login-advanced,我发现这是学习一些有用的php结构的一个非常好的方法 不幸的是,有一件事我不明白,这让我很头疼:所有的一切都从index.php开始,其中包括login_manager.php,用于从classes/login.php创建一个新的登录实例 // create a login object. when this object is create

我对PHP非常陌生,但已经习惯了一些其他编程语言,如JAVA、Python。最近,我仔细研究了登录脚本panique/php Login-advanced,我发现这是学习一些有用的php结构的一个非常好的方法

不幸的是,有一件事我不明白,这让我很头疼:所有的一切都从index.php开始,其中包括login_manager.php,用于从classes/login.php创建一个新的登录实例

// create a login object. when this object is created, it will do all login/logout stuff automatically
// so this single line handles the entire login process.
$login = new Login();
如果您没有登录,您可以注册自己,这将导致您进入views/register.php。在此文件中有一个POST表单,再次调用同一文件:

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

<!-- show registration form, but only if we didn't submit already -->
<?php if (!$registration->registration_successful && !$registration->verification_successful) { ?>
<form method="post" action="register.php" name="registerform">
    <label for="user_name"><?php echo WORDING_REGISTRATION_USERNAME; ?></label>
    <input id="user_name" type="text" pattern="[a-zA-Z0-9]{2,64}" name="user_name" required />

    <label for="user_email"><?php echo WORDING_REGISTRATION_EMAIL; ?></label>
    <input id="user_email" type="email" name="user_email" required />

    <label for="user_password_new"><?php echo WORDING_REGISTRATION_PASSWORD; ?></label>
    <input id="user_password_new" type="password" name="user_password_new" pattern=".{6,}" required autocomplete="off" />

    <label for="user_password_repeat"><?php echo WORDING_REGISTRATION_PASSWORD_REPEAT; ?></label>
    <input id="user_password_repeat" type="password" name="user_password_repeat" pattern=".{6,}" required autocomplete="off" />

    <img src="tools/showCaptcha.php" alt="captcha" />

    <label><?php echo WORDING_REGISTRATION_CAPTCHA; ?></label>
    <input type="text" name="captcha" required />

    <input type="submit" name="register" value="<?php echo WORDING_REGISTER; ?>" />
</form>
<?php } ?>

    <a href="index.php"><?php echo WORDING_BACK_TO_LOGIN; ?></a>

<?php include('_footer.php'); ?>
但这里的连接在哪里?我用所有文件搜索了整个项目,但找不到像new Registration这样的内容,甚至$Registration变量也从未设置为我所知。因此,由于脚本工作没有问题,需要一些技巧,我不知道

我还以为可以在uheader.php中设置,但在这个文件中只有一些错误输出:

// show potential errors / feedback (from registration object)
if (isset($registration)) {
    if ($registration->errors) {
        foreach ($registration->errors as $error) {
            echo $error;
        }
    }
    if ($registration->messages) {
        foreach ($registration->messages as $message) {
            echo $message;
        }
    }
}

检查根目录omg中的register.php文件,非常感谢!!我发现了我的错误:我使用FTP与我的Web服务器同步了我的文件。不幸的是,根目录中的register.php在本地计算机上丢失,但在Web服务器上确实存在。这就是它起作用的原因,但我不明白为什么。。。再次感谢!
// show potential errors / feedback (from registration object)
if (isset($registration)) {
    if ($registration->errors) {
        foreach ($registration->errors as $error) {
            echo $error;
        }
    }
    if ($registration->messages) {
        foreach ($registration->messages as $message) {
            echo $message;
        }
    }
}