php技术博客
让天下没有搞不定的bug~

thinkphp视图模型查询失败提示:ERR: 1146:Table ‘db.pr_order_view’ doesn’t exist

想用thinkphp的视图模型进行关联查询,结果出现了这样的问题(log日志记录):ERR: 1146:Table ‘db.pr_order_view’ doesn’t exist,我就纳闷,视图模型怎么出来的sql是这样的呢,视图模型如下:
[warning]
* @date 2013-8-1
* @link https://zoneself.vip
*/
class OrderViewModel extends ViewModel
{
public $viewFields = array(
‘Order’ =>array(
‘_as’=>’Orders’, //重新命名,以免与系统语法冲突
‘id’=>’oid’,
‘ordid’,
‘user’,
‘product’,
‘status’,
‘paynum’,
‘cat’,
‘payment_trade_no’,
‘ip’=>’mip’,
‘reserve_time’,
‘createtime’,
‘payment_trade_status’,
),
‘Member’=>array(
‘id’=>’mid’,
‘name’=>’uname’,
‘cardnum’,
‘tel’,
‘reg_time’,
‘reg_ip’,
‘qq’,
’email’,
‘address’,
‘last_login_time’,
‘last_login_ip’,
‘_on’=>’Orders.user=Member.id’
),
‘Product’=>array(
‘id’,
‘shorttitle’,
‘img1’,
‘category’,
‘_on’=>’Orders.product=Product.id’
),
);

}
?>[/warning]
 
看了手册及百度了很多,没有找到解决方案,调用也没有错$Form = D(‘Admin/OrderView’);(这里我用了分组)经过我自己查看,原来是有问题的,原来视图模型的名字命名错了,唉,OrderView.class.php,正常应该是 OrderViewModel.class.php 唉,太粗心了,希望朋友们不要犯这样的低级错误额!

赞(0)
未经允许不得转载:PHP技术博客 » thinkphp视图模型查询失败提示:ERR: 1146:Table ‘db.pr_order_view’ doesn’t exist