Heim > Artikel > Backend-Entwicklung > thinkphp 3.2 视图模型 生成的SQL语句提示 1267异常 求指点
thinkphp 3.2 视图模型 生成的SQL语句提示 1267错误 求指点~
用的TP3.2 视图模型 查询
模型里是这样写的
PicViewModel.class.php
<?php<br />namespace Home\Model;<br />use Think\Model\ViewModel;<br />class PicViewModel extends ViewModel{<br /> public $viewFields =array(<br /> 'Picture'=> array('picTitle','picToken','picCategroy','picAuthor','picPostTime','_as'=>'Picture'),<br /> 'PictureAttachment' =>array('pictureid','pictureurl','creattime','_on'=>'Picture.picToken = PictureAttachment.pictureid','_as'=>'PictureAttachment'),<br /><br /><br /> );<br />}<br />
public function Pic(){<br /> $PicModel =D('PicView'); <br /> $s1= $PicModel->field('picTitle,picCategroy,picAuthor,picPostTime,pictureurl')->order('picPostTime desc')->select();<br /> dump($PicModel->getLastSql());<br /> dump($s1);<br /><br /> }
SELECT Picture.picTitle AS picTitle,Picture.picCategroy AS picCategroy,Picture.picAuthor AS picAuthor,Picture.picPostTime AS picPostTime,PictureAttachment.pictureurl AS pictureurl FROM xxx_picture Picture JOIN xxx_picture_attachment PictureAttachment ON Picture.picToken = PictureAttachment.pictureid ORDER BY Picture.picPostTime desc