2013-12-18 7 views
0

hybridauth version 2.1.2을 사용하려고하는데 this tutorial to install it.을 사용하면 불행히도이 오류가 발생합니다.스트림을 열지 못했습니다 : 해당 파일이나 디렉토리가 없습니다.

include(/Applications/XAMPP/xamppfiles/htdocs/dev/protected/extensions/components/HybridAuthIdentity.php): failed to open stream: No such file or directory 

내 디렉토리 구조는 왜이 디렉토리 protected/extensions/components 대신 단지 protected/components에서 파일을 찾아 않는 등

/*numbers indicate the folder or file depth*/ 
1 components 
    2 HybridAuthIdentity.php 

1 controllers 
    2 SiteController.php 

1 extensions 
    2 HybridAuth 
    3 hybridauth-2.1.2 
     4 hybridauth 
     5 index.php 
     5 Hybrid 
      6 Auth.php 

같다? 난 내 actionLogin() (아래) 내가 오류가이 줄을 생각 편집 Yii::import('ext.components.HybridAuthIdentity');

난 내 로그인 페이지에서이 클릭 할 때 오류가

<a href="http://mysite/login?provider=facebook" ><img src="images/buttons/facebook.png" /></a> 
(내 로그인 페이지 http://mysite/login입니다) 팝업

누군가 나를 도울 수 있습니까? 미리 감사드립니다.

/** 
    * Displays the login page 
    */ 
    public function actionLogin() { 
     //action only for the login from third-party authentication providers, such as Google, Facebook etc. Not for direct login using username/password 
     if (!isset($_GET['provider'])) 
     { 
      if(app()->user->isGuest()){ 
       $model = new LoginForm; 

       // if it is ajax validation request 
       if (isset($_POST['ajax']) && $_POST['ajax'] === 'login-form') { 
        echo CActiveForm::validate($model); 
        app()->end(); 
       } 

       // collect user input data 
       if (isset($_POST['LoginForm'])) { 
        $model->attributes = $_POST['LoginForm']; 
        // validate user input and redirect to the previous page if valid 
        if ($model->validate() && $model->login()) { 
         $user = app()->user->getUser(); 
         User::model()->updateByPk($user->id, array('last_login' => new CDbExpression('NOW()'))); 
         if (isset($_POST['ajax'])) { 
          echo app()->user->getHomeUrl(); 
          app()->end(); 
         } else { 
          $this->redirect(app()->user->returnUrl); 
         } 
        } else { 
         if (isset($_POST['ajax'])) { 
          echo "bad"; 
          app()->end(); 
         } else { 
          app()->user->setFlash('error', 'Login failed. Please try again.'); 
         } 
        } 
       } 
       // display the login form 
       $this->render('login', array('model' => $model)); 
      } else { 
       $this->redirect(array('/user/update', 'id' => app()->user->id)); 
      } 
     } 
     else { 
      try 
      { 
       Yii::import('ext.components.HybridAuthIdentity'); 
       $haComp = new HybridAuthIdentity(); 
       if (!$haComp->validateProviderName($_GET['provider'])) 
        throw new CHttpException ('500', 'Invalid Action. Please try again.'); 

       $haComp->adapter = $haComp->hybridAuth->authenticate($_GET['provider']); 
       $haComp->userProfile = $haComp->adapter->getUserProfile(); 

       $haComp->login(); 
       $this->redirect(''); //redirect to the user logged in section.. 

       $haComp->processLogin(); //further action based on successful login or re-direct user to the required url 
      } 
      catch (Exception $e) 
      { 
       //process error message as required or as mentioned in the HybridAuth 'Simple Sign-in script' documentation 
       $this->redirect('/site/index'); 
       return; 
      } 
     } 
    } 

답변

1

당신 말이 맞습니다. 그 줄은 Yii::import('app.components.HybridAuthIdentity')이어야합니다. 그러나 components 폴더의 클래스는 기본적으로 자동로드되므로이 줄이 없어야합니다.

+0

'components 폴더는 기본적으로 자동으로로드됩니다 .' 오늘 새로운 것을 배웠습니다. :) thanks – user2636556

관련 문제