2016-05-18 5 views
-2

cakephpを使っていて、ログアウトボタンをクリックしている間にURLが別のアドレスに移動しましたhttp://demo4sbc.com.Because view/userにlogout.ctpはありません。 logout.ctpページ。cakephpのビュー/ユーザーのログアウトページがありません

+0

usersControllerにlogout()アクションのコードを投稿してください。 – arilia

+0

UsersControllerにログアウトメソッドを作成しましたか? –

+0

function logout() \t { \t \t $ this-> Session-> destroy(); \t \t $ this-> redirect($ this-> Auth-> logout()); \t} \t公開機能google_logout(){ \t \t $ this-> Session-> destroy(); \t \t \t \t $ this-> Session-> delete( 'Glogin'); header( '場所:https://www.google.com/accounts/Logout?continue=https://appengine.google.com/_ah/logout?continue=http://yesstays.com/'); $ this-> redirect($ this-> Auth-> logout()); \t \t –

答えて

0

あなたがログアウト後にユーザーをリダイレクトする場所だけ確認し、logout.ctpビューを必要とするドント

どのようにこれについて:

UsersController.php

public function logout() { 

    $this->Session->destroy(); 

    return $this->redirect($this->Auth->logout()); 
} 

AppController.php

class AppController extends Controller 
{ 

    public function initialize() 
    { 
     parent::initialize(); 
     $this->loadComponent('Auth', array(
      'authenticate' => array(
       'Form' => array('fields' => array('username' => 'email', 'password' => 'password')) 
      ), 
      //Controller and Action where you want redirect users after login 
      'loginRedirect' => array(
       'controller' => 'Users', 
       'action' => 'index' 
      ), 
      //Controller and Action where you want redirect users after logout 
      'logoutRedirect' => array(
       'controller' => 'Pages', 
       'action' => 'home', 
      ), 
     )); 

    } 
+0

ありがとう、私は自分のエラーを持っていて、今私はデータベースと検索結果に空白のページです...なぜ –

+0

私はこの新しいエラーthxで新しい質問を作成することをお勧めします –

関連する問題