我是cakephp
的新手,尽管我在codeigniter
工作,因此具有MVC
知识。所以我的控制器posts_controller.php
是:
<?php
class PostsController extends AppController {
public $helpers = array('Html', 'Form');
public function index() {
$this->set('posts', $this->Post->find('all'));
}
}
型号
Post.php
为:<?php
class Post extends AppModel {
}
我在数据库中创建了一个表
posts
,并添加了一些数据。但是当我运行控制器http://localhost/cake1.3/index.php/posts
时,它说缺少数据库表
错误:找不到模型发布的数据库表发布。
注意:如果要自定义此错误消息,请创建
应用程序\视图\错误\ missing_table.ctp
代码有什么问题?
注意:我需要使用
cakephp version 1.3
最佳答案
错误:找不到模型发布的数据库表发布。
该错误表明数据库中没有“ posts”表。
几个解决方案:
检查您的数据库连接App-> config-> database.php,并确保一切正确。
确保数据库中有一个名为“ posts”的表
关于mysql - 找不到数据库表cakephp,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/20240041/