我正在使用 cakephp 1.26 在我的本地主机中创建一个简单的留言板。
当我尝试将两个表链接在一起时,出现此错误:
Error: Database table posts for model post was not found.
这是两个表的表结构:
表'post'有这些字段{PostID,Topic,Content}
,表'reply'有这些字段{ReplyID,PostID,CreationDate}
这是模型site1.php的代码:
<?php
class Site1 extends AppModel {
var $name = 'Site1';
var $useTable = 'post';
var $primaryKey = 'PostID';
var $hasMany = 'Reply';
}
?>
这是模型reply.php的代码:
<?php
class Reply extends AppModel {
var $name = 'Reply';
var $useTable = 'reply';
var $primaryKey = 'ReplyID';
var $belongsTo ='post';
}
?>
你能帮我解决问题吗?