在做一个订单系统,在用视图模型的时候打印不出东西。
自定义的视图模型
<?php//订单视图Class OrderViewModel extends ViewModel{ public $viewFields = array( 'order' => array('id','orderNo','date','money','memo','state','_type'=>'LEFT'), 'client' => array('clientName','_on'=>'order.client_id=client.id','_type'=>'RIGHT'), 'user' => array('userName','_on'=>'order.user_id=user.id'), ); }?>$Model = D("OrderView"); $result = $Model->select(); p($result);die;SELECT order.id AS id,order.orderNo AS orderNo,order.date AS date,order.money AS money,order.memo AS memo,order.state AS state,client.clientName AS clientName,user.userName AS userName FROM or_order order LEFT JOIN or_client client ON order.client_id=client.id RIGHT JOIN or_user user ON order.user_id=user.id
已在config文件中加了自动表前缀
生成的sql语句执行有什么问题?
生成的sql语句执行有什么问题?
表的别名不要用order,
order是关键字~
表的别名不要用order,
order是关键字~
PHP怎么学习?PHP怎么入门?PHP在哪学?PHP怎么学才快?不用担心,这里为大家提供了PHP速学教程(入门到精通),有需要的小伙伴保存下载就能学习啦!
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号