来自config / main.php:
'db'=>array(
'connectionString' => 'mysql:host=localhost;dbname=testdb',
'emulatePrepare' => true,
'username' => 'root',
'password' => '',
'charset' => 'utf8',
),
当我使用gii模型生成器(http://localhost/yii/testdelete/index.php?r = gii / model)并尝试将“post”或“user”放入表名并单击“预览”时“它说:
表'post'不存在。
我希望能够使用这些表创建模型。
从phpMyAdmin导出:
-- Host: 127.0.0.1
-- Database: `testdb`
CREATE TABLE IF NOT NOT EXISTS post
(
id
int(10)unsigned NOT NULL AUTO_INCREMENT,
created_on
int(11)unsigned NOT NULL,
title
varchar(255)COLLATE utf8_unicode_ci NOT NULL,
content
text COLLATE utf8_unicode_ci NOT NULL,
主要关键(id
)
)ENGINE = InnoDB DEFAULT CHARSET = utf8 COLLATE = utf8_unicode_ci AUTO_INCREMENT = 1;
CREATE TABLE IF NOT NOT EXISTS user
(
id
int(10)unsigned NOT NULL AUTO_INCREMENT,
username
varchar(200)COLLATE utf8_unicode_ci NOT NULL,
password
char(40)COLLATE utf8_unicode_ci NOT NULL,
主要关键(id
)
)ENGINE = InnoDB DEFAULT CHARSET = utf8 COLLATE = utf8_unicode_ci AUTO_INCREMENT = 1;
答案 0 :(得分:2)
如果在“表格名称”字段中键入“s”,则会弹出两个表格。
检查