首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >CakePHP -导航到页面上的空白页面

CakePHP -导航到页面上的空白页面
EN

Stack Overflow用户
提问于 2011-08-02 23:53:19
回答 1查看 410关注 0票数 0

我有以下控制器方法:

代码语言:javascript
复制
function recover_password() {
        $this->layout = 'frontend';
        $this->loadModel('PasswordReset');
        $this->Fonyker->recusive = -1;

        if($this->data) {
            $fields = array(
                'Fonyker.fonykid',
                'Fonyker.username',
                'Fonyker.name',
                'Fonyker.email'
            );

            $fonyker = $this->Fonyker->find('first', array(
                'conditions' => array(
                    'OR' => array(
                        'Fonyker.email' => $this->data['Fonyker']['field'],
                        'Fonyker.username' => $this->data['Fonyker']['field']
                    ) 
                ),
                'fields' => $fields
            ));

            if($fonyker) {
                $this->PasswordReset->create();

                $passwordReset = array();
                $passwordReset = array(
                    'PasswordReset' => array(
                        'code' => hash('sha256', $fonyker['Fonyker']['fonykid'].StringUtils::getRandomString(20)),
                        'fonykid' => $fonyker['Fonyker']['fonykid']
                    )
                );

                $this->PasswordReset->save($passwordReset);

                $data = array(
                    'username' => $fonyker['Fonyker']['username'],
                    'code' => $passwordReset['PasswordReset']['code'],
                    'name' => $fonyker['Fonyker']['name'],
                    'email' => $fonyker['Fonyker']['email']
                );

                $this->_sendPasswordResetEmail($data);

            } else {

            }
        } 
    }

这是视图:

代码语言:javascript
复制
<div class="prepend-top span-24">
    <div class="prepend-8 span-8 append-8">
        <?php

            echo $this->Form->create('Fonyker', array('action' => 'recover_password'));
            echo $this->Form->input('email', array(
                'div' => array(
                    'class' => 'span-8'
                ),
                'class' => 'input-text long',
                'id' => 'FonykerEmail',
                'label' => array(
                    'class' => 'inlined',
                    'text' => ''
                ),
                'placeholder' => 'Username or Email'
            ));

            echo $this->Form->submit('',array(
                'div' => array(
                    'class' => 'span-2 last'
                ),
            ));

            echo $this->Form->end();
        ?>
    </div>
</div>

当我导航到页面时,我得到的只是一个空白页面,有时会出现以下错误:Fatal error: Maximum execution time of 60 seconds exceeded in Unknown on line 0

更新:错误似乎正在加载我的模型,这是我声明的模型:

代码语言:javascript
复制
<?php
class PassswordReset extends AppModel {
    var $name = 'PasswordReset';
    var $displayField = 'id';
    var $validate = array(
        'code' => array(
            'alphanumeric' => array(
                'rule' => array('alphanumeric'),
                //'message' => 'Your custom message here',
                //'allowEmpty' => false,
                //'required' => false,
                //'last' => false, // Stop validation after this rule
                //'on' => 'create', // Limit validation to 'create' or 'update' operations
            ),
        ),
        'fonykid' => array(
            'alphanumeric' => array(
                'rule' => array('alphanumeric'),
                //'message' => 'Your custom message here',
                //'allowEmpty' => false,
                //'required' => false,
                //'last' => false, // Stop validation after this rule
                //'on' => 'create', // Limit validation to 'create' or 'update' operations
            ),
        )
    );
}
?>

如果我删除了loadModel()调用,页面就会加载。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2011-08-03 12:54:55

数据库中是否有一个名为password_resets的表?此外,您可能希望在需要loadModel之前将它移到行中。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/6914878

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档