视图模型 查询 返回bool(false) 请问这么写对么?

浏览:1924 发布日期:2014/11/18 分类:求助交流 关键字: 视图模型查询
搜索了不少 以前做出来过 现在又忘记了。。。 求好心人帮忙看看~
视图模型 PicViewModel.class.php<?php
namespace Home\Model;
use Think\Model\ViewModel;
class PicViewModel extends  ViewModel{
    public $viewFields =array(
       'picture'=> array('picTitle','picToken','picCategroy','picAuthor','picPostTime'),
        'picture_attachment' =>array('pictureid','pictureurl','creattime','_on'=>'picture.picToken = picture_attachment.pictureid'),

    );
}
控制器里的方法    public function  Pic(){
         $PicModel =D('PicView');
        dump($PicModel);
         $s =   $PicModel->field('picTitle,picCategroy,picAuthor,picPostTime,pictureurl')->order('picPostTime DESC')->select();
        dump($s);

    }
查询出来就是bool(false)
不知道是不是表名的问题呢 这个是正确的表前缀["tablePrefix":protected]
还是看下面的 ["model":protected] 这个呢?
["db":protected] => object(Think\Db\Driver\Mysql)#8 (19) {
["dbType":protected] => NULL
["autoFree":protected] => bool(false)
["model":protected] => string(7) "_think_"
["pconnect":protected] => bool(false)
["queryStr":protected] => string(0) ""
["modelSql":protected] => array(0) {
}
["lastInsID":protected] => NULL
["numRows":protected] => int(0)
["numCols":protected] => int(0)
["transTimes":protected] => int(0)
["error":protected] => string(0) ""
["linkID":protected] => array(0) {
}
["_linkID":protected] => NULL
["queryID":protected] => NULL
["connected":protected] => bool(false)
["autoinc":protected] => bool(false)
["patchValidate":protected] => bool(false)
看了好几遍手册感觉还是不能理解? 求指点 ~
最佳答案
评论( 相关
后面还有条评论,点击查看>>