簡體   English   中英

cakephp 2.X連接在實時服務器上的重定向超時

[英]cakephp 2.X Connection timed out on redirect on a live server

我有一個“注冊”頁面,該頁面接受用戶名,密碼並從用戶確認密碼數據。 在我的本地計算機上,它只是重定向就可以了。 我認為問題出在php的最大執行時間上,但是我已經與托管服務商聯系過,並被告知托管公司的最大執行時間不受更改。

這是我的代碼。 我認為我的代碼沒有任何問題,因為它在我的本地計算機上運行良好。

public function register($role = null){
    $this->reg_status();
    if($this->Auth->user()){
        return $this->redirect(array('action' => 'dashboard'));
    }

    if ($this->request->is('post')) {

        $this->User->create();
        $existing = $this->User->find('first', array(
        'conditions' => array('email' => $this->request->data['User']['email'])
        ));
        if($existing){
            $this->Session->setFlash(__('Email is already used.'), 'default', array('class' => 'alert alert-danger'));
        } else{
            if($this->request->data['User']['password']==$this->request->data['User']['conf_password']){

                if($role){
                    $role = ($role == 'as_adviser') ? 'adviser' : 'client';
                    $this->request->data['User']['role'] = $role;
                }
                if ($this->User->save($this->request->data)) {
                    $id = $this->User->getLastInsertId();
                    $this->sendMail($this->request->data['User']['email'], $id, 'verify');
                    return $this->redirect(array('action' => 'confirm_email', $id, urlencode(base64_encode($this->request->data['User']['email']))));
                } else {
                    $this->Session->setFlash(__('The user could not be saved. Please, try again.'), 'default', array('class' => 'alert alert-danger'));
                }
            } else{
                $this->Session->setFlash(__("Password did not match."), 'default', array('class' => 'alert alert-danger'));
            }
        }
    }

    $this->set('role', $role);
}

這是我在實時服務器上遇到的錯誤。 在此處輸入圖片說明

我目前不知所措,因為即使我“打開” cakephp的config / core上的調試,錯誤似乎仍然模糊。

編輯必須更改電子郵件配置smtp設置。 確保它們是正確的並且錯誤消失了。

$this->sendMail($this->request->data['User']['email'], $id, 'verify');

此行問題注釋此行並檢查。

必須更改電子郵件配置smtp設置。 確保它們是正確的並且錯誤消失了

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM