[英]Database table not found cakephp
I am new to cakephp
, though I have worked in codeigniter
hence having MVC
knowledge. 我是
cakephp
新手,尽管我曾在codeigniter
工作,因此拥有MVC
知识。 So my controller posts_controller.php
is: 所以我的控制器
posts_controller.php
是:
<?php
class PostsController extends AppController {
public $helpers = array('Html', 'Form');
public function index() {
$this->set('posts', $this->Post->find('all'));
}
}
Model Post.php
is : 模型
Post.php
是:
<?php
class Post extends AppModel {
}
I have created a table posts
in my database and added some data. 我在数据库中创建了一个表
posts
,并添加了一些数据。 But when I run my controoler http://localhost/cake1.3/index.php/posts
it says 但是当我运行控制器
http://localhost/cake1.3/index.php/posts
它说
Missing Database Table
缺少数据库表
Error: Database table posts for model Post was not found.
错误:找不到模型发布的数据库表发布。
Notice: If you want to customize this error message, create app\\views\\errors\\missing_table.ctp
注意:如果要自定义此错误消息,请创建app \\ views \\ errors \\ missing_table.ctp
Whats wrong with the code ? 代码有什么问题?
NB: I needed to use cakephp version 1.3
注意:我需要使用
cakephp version 1.3
Error: Database table posts for model Post was not found.
错误:找不到模型发布的数据库表发布。
This error indicates that there is no 'posts' table in your database. 该错误表明数据库中没有“ posts”表。
A couple solutions: 几个解决方案:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.