当前位置:Gxlcms > PHP教程 > thinkphp3.2视图模型查询出来bool(false)求解

thinkphp3.2视图模型查询出来bool(false)求解

时间:2021-07-01 10:21:17 帮助过:8人阅读

模型里这么写的
 array('picTitle','picToken','picCategroy','picAuthor','picPostTime','_type'=>'LEFT'),        'picture_attachment' =>array('pictureid','pictureurl','creattime','_on'=>'picture.picToken = picture_attachment.pictureid'),    );}

picture和picture_attachment两张表
控制器里这么写的 我用D方法实例化PicView 这个是必须在数据库里真实的表名么
    public function  Pic(){         $PicModel =D('PicView');        dump($PicModel);         $s =   $PicModel->select();        dump($s);    }


返回的一些错误
["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)


回复讨论(解决方案)

# PicView 模型初始化,如果该PicView类存在则调用并初始化,如果不存在 ,则根据表名初始化模型         $PicModel =D('PicView'); #
输出所有数据 实际执行的SQL语句是# SELECT * FROM PicView $s = $PicModel->select();
PHP初学者不建议直接看框架!

# PicView 模型初始化,如果该PicView类存在则调用并初始化,如果不存在 ,则根据表名初始化模型         $PicModel =D('PicView'); #
输出所有数据 实际执行的SQL语句是# SELECT * FROM PicView $s = $PicModel->select();
PHP初学者不建议直接看框架!


谢谢好心人 我已经解决了 就是两个表的字段排序不一样造成了 其他的还好 框架使用方便点

人气教程排行