3.1.2 - 普通 - 已关闭
我是按照快速入门教程中的内容来编写的出现以下错误内容: Access denied for user ''@'localhost' to databa
IndexAction 的代码
class IndexAction extends Action {
public function index(){
$Data = M('Data'); // 实例化Data数据模型
$this->data = $Data->select();
$this->display();
}
}
Config 的代码
// 数据库设置
'DB_TYPE' => 'mysql',
'DB_HOST' => 'localhost',
'DB_NAME' => 'thinkphp',
'DB_USER' => 'root',
'DB_PWD' => 'admin123',
'DB_PORT' => 3306,
'DB_PREFIX' => 'think_',
// ThinkPHP 的设置
//'APP_DEBUG' => true,
'LAYOUT_ON' => true,
'URL_CASE_INSENSITIVE' => true,
// 自定义全局常量
'ba
);
Tpl 的 Index 代码
<volist name="data" id="vo">
{$vo.id}--{$vo.data}<br/>
</volist>
TRACE
[15-03-02 14:24:03] C:\wamp\www\lab\thinkphp\3.1.2\Lib\Core\Db.class.php (164) DbMysql->connect()
[15-03-02 14:24:03] C:\wamp\www\lab\thinkphp\3.1.2\Lib\Driver\Db\DbMysql.class.php (94) Db->initConnect()
[15-03-02 14:24:03] C:\wamp\www\lab\thinkphp\3.1.2\Lib\Driver\Db\DbMysql.class.php (213) DbMysql->query(SHOW COLUMNS FROM `think_data`)
[15-03-02 14:24:03] C:\wamp\www\lab\thinkphp\3.1.2\Lib\Core\Model.class.php (135) DbMysql->getFields(think_data)
[15-03-02 14:24:03] C:\wamp\www\lab\thinkphp\3.1.2\Lib\Core\Model.class.php (123) Model->flush()
[15-03-02 14:24:03] C:\wamp\www\lab\thinkphp\3.1.2\Lib\Core\Model.class.php (1174) Model->_checkTableInfo()
[15-03-02 14:24:03] C:\wamp\www\lab\thinkphp\3.1.2\Lib\Core\Model.class.php (98) Model->db(0, )
[15-03-02 14:24:03] C:\wamp\www\lab\thinkphp\3.1.2\Common\common.php (294) Model->__construct(Data, , )
[15-03-02 14:24:03] C:\wamp\www\lab\thinkphp\learn-3.1.2\app\Lib\Action\IndexAction.class.php (5) M(Data)
[15-03-02 14:24:03] () IndexAction->index()
[15-03-02 14:24:03] C:\wamp\www\lab\thinkphp\3.1.2\Lib\Core\App.class.php (171) ReflectionMethod->invoke()
[15-03-02 14:24:03] C:\wamp\www\lab\thinkphp\3.1.2\Lib\Core\App.class.php (207) App::exec()
[15-03-02 14:24:03] C:\wamp\www\lab\thinkphp\3.1.2\Lib\Core\Think.class.php (39) App::run()
[15-03-02 14:24:03] C:\wamp\www\lab\thinkphp\3.1.2\Common\runtime.php (242) Think::start()
[15-03-02 14:24:03] C:\wamp\www\lab\thinkphp\3.1.2\ThinkPHP.php (30) require(C:\wamp\www\lab\thinkphp\3.1.2\Common\runtime.php)
[15-03-02 14:24:03] C:\wamp\www\lab\thinkphp\learn-3.1.2\index.php (6) require(C:\wamp\www\lab\thinkphp\3.1.2\ThinkPHP.php)
