2011-11-19 3 views
1

나는 아름다운 Yii 프레임 워크에 익숙하지 않습니다. 자습서와 문서를 살펴 보겠습니다. 그래서 나는 시작부터 블로그 튜토리얼을하고있다. 그래서 블로그 애플리케이션을 위해 MySQL에 Yii와 함께 제공되는 블로그 폴더에서 데이터베이스를 내보냈습니다. 다시 Yii 사용자 모듈을 사용하기로 결정하고 MySQL에 사용자 모듈 데이터베이스를 내보냈습니다. 이제 내 문제는 내가 응용 프로그램에 로그인을 사용하고 때 나는 모두 index.php?r=site/login 모두 실패도 index.php?r=user/login 노력이YII 프레임 워크의 로그인 오류

Trying to get property of non-object 

같은 몇 가지 오류를 보여주고 있다는 점이다. 그래서 어떤 사람들은 이것을 어떻게 해결할 수 있는지 말해 줄 수 있습니다. FYI 내 데이터베이스에는 블로그 폴더에서 가져온 'ia_user'와 Yii 사용자 모듈 폴더에서 가져온 'ia_users'와 같은 두 개의 필드가 있습니다. 그래서 잘못된 것이 있습니다. 아래 main.php 파일의 설정을 붙이고 있습니다.

<?php 

// uncomment the following to define a path alias 
// Yii::setPathOfAlias('local','path/to/local-folder'); 

// This is the main Web application configuration. Any writable 
// CWebApplication properties can be configured here. 
return array(
    'basePath'=>dirname(__FILE__).DIRECTORY_SEPARATOR.'..', 
    'name'=>'My Blog Application', 

    // preloading 'log' component 
    'preload'=>array('log'), 

    // autoloading model and component classes 
    'import'=>array(
    'application.models.*', 
    'application.components.*', 
    /*user module starts here*/ 
    'application.modules.user.models.*', 
    'application.modules.user.components.*', 
    /*user module ends here*/ 
), 

    'modules'=>array(
    // uncomment the following to enable the Gii tool 
    /* 
    'gii'=>array(
     'class'=>'system.gii.GiiModule', 
     'password'=>'Enter Your Password Here', 
     // If removed, Gii defaults to localhost only. Edit carefully to taste. 
     'ipFilters'=>array('127.0.0.1','::1'), 
    ), 
    */ 
), 

    // application components 
    'components'=>array(
    'user'=>array(
     // enable cookie-based authentication 
     'allowAutoLogin'=>true, 
     /*user module starts here*/ 
     'loginUrl' => array('/user/login'), 
     /*user module ends here*/ 
    ), 
    // uncomment the following to enable URLs in path-format 
    /* 
    'urlManager'=>array(
     'urlFormat'=>'path', 
     'rules'=>array(
     '<controller:\w+>/<id:\d+>'=>'<controller>/view', 
     '<controller:\w+>/<action:\w+>/<id:\d+>'=>'<controller>/<action>', 
     '<controller:\w+>/<action:\w+>'=>'<controller>/<action>', 
    ), 
    ), 
    */ 
    //'db'=>array(
    // 'connectionString' => 'sqlite:'.dirname(__FILE__).'/../data/testdrive.db', 
    //), 
    // uncomment the following to use a MySQL database 

    'db'=>array(
     'connectionString' => 'mysql:host=localhost;dbname=tbl_blog', 
     'emulatePrepare' => true, 
     'username' => 'root', 
     'password' => 'root', 
     'charset' => 'utf8', 
     'tablePrefix'=> 'tbl_', 
    ), 

    'errorHandler'=>array(
     // use 'site/error' action to display errors 
      'errorAction'=>'site/error', 
     ), 
    'log'=>array(
     'class'=>'CLogRouter', 
     'routes'=>array(
     array(
      'class'=>'CFileLogRoute', 
      'levels'=>'error, warning', 
     ), 
     // uncomment the following to show log messages on web pages 
     /* 
     array(
      'class'=>'CWebLogRoute', 
     ), 
     */ 
    ), 
    ), 
), 

    // application-level parameters that can be accessed 
    // using Yii::app()->params['paramName'] 
    'params'=>array(
    // this is used in contact page 
    'adminEmail'=>'[email protected]', 
), 
); 

도움이 저를 out.Any 도와주세요과 제안은 매우 appreciable.I가 YII 포럼에서 도움을 요청하지만 난 여기에 도움을 요청하고 그래서 어떤 회신을 받았는데되지 않습니다. `/ * 사용자 모듈 */'loginUrl'여기서 시작 :

+0

같은 모듈의 배열에 사용자를 추가했지만, 나는 이것이 설정에 참조 => 배열 ('/ user/login'),', 아마도 시도해 볼 수 있습니다 : index.php? r =/user/login - 그러나 그 행운을 넘어서십시오! –

+2

표시되는 오류는 파일 이름과 줄을 가져야합니다. 해당 코드를 살펴보고 오류를 찾으십시오. 그런 다음 계속해서 그 오류의 원인이 무엇인지 찾아냅니다. 원인을 수정하십시오. 그것은 디버깅이라고 불리며 질문에 게시 한 코드는 사이트의 일부분이므로 말하기는 어렵습니다. 또한 참조하십시오 [비 객체의 속성을 얻으려고] (0120-13755) – hakre

+0

loginUrl "/ user/login "을"user/login "("/ "기호 없음)으로 변경하십시오. 그리고 좀 더 구체적인 로그 메시지를줍니다. 왜냐하면 어떤 객체의 속성을 얻을 수없는 곳을보아야하기 때문입니다. –

답변

0

난 그냥 그대로이 프레임 워크에 대해 _nothing_을 알고이

'user'=>array(
     'user' 
     // enable cookie-based authentication 
     'allowAutoLogin'=>true, 
     /*user module starts here*/ 
     'loginUrl' => array('/user/login'), 
     /*user module ends here*/ 
    ), 
관련 문제