[英]Login Error in YII Framework
我是美丽的Yii Framework的新手。 因此,我只是在阅读教程和文档。 所以我从一开始就在做博客教程。 因此,对于博客应用程序,我将数据库从Yii随附的博客文件夹导出到MySQL。 我再次决定使用Yii用户模块,并为此将用户模块数据库导出到MySQL。 现在我的问题是,当我在应用程序中使用登录名时,它显示了这样的错误
Trying to get property of non-object
我都尝试了index.php?r=site/login
,而且index.php?r=user/login
都失败了。 所以有人可以告诉我如何解决这个问题。 仅供参考,在我的数据库中有两个字段,例如从博客文件夹导入的“ 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'=>'webmaster@example.com',
),
);
请帮帮我。任何帮助和建议都是非常可贵的。我向Yii论坛寻求帮助,但没有得到任何答复,所以我在这里请求帮助。
我不得不像这样在模块数组中添加用户
'user'=>array(
'user'
// enable cookie-based authentication
'allowAutoLogin'=>true,
/*user module starts here*/
'loginUrl' => array('/user/login'),
/*user module ends here*/
),
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.