thinkphp 3.2 View model query out bool (false) solve
It's written in this model.
namespace Home\model;
Use Think\model\viewmodel;
Class Picviewmodel extends viewmodel{
Public $viewFields =array (
' Picture ' = = Array (' Pictitle ', ' pictoken ', ' Piccategroy ', ' picauthor ', ' picposttime ', ' _type ' = ' left '),
' Picture_attachment ' =>array (' Pictureid ', ' pictureurl ', ' creattime ', ' _on ' = ' picture.pictoken ' = picture_ Attachment.pictureid '),
);
}
Picture and picture_attachment two tables
That's what the controller says. I instantiate Picview with the D method. Is this the real table name that must be in the database?
Public Function Pic () {
$PicModel =d (' Picview ');
Dump ($PicModel);
$s = $PicModel->select ();
Dump ($s);
}
Some of the errors returned
["DB":p rotected] + object (think\db\driver\mysql) #8 (19) {
["DbType":p rotected] = NULL
["Autofree":p rotected] = bool (false)
["Model":p rotected] and string (7) "_think_"
["Pconnect":p rotected] = bool (false)
["Querystr":p rotected] = string (0) ""
["Modelsql":p rotected] = = Array (0) {
}
["Lastinsid":p rotected] = NULL
["NumRows":p rotected] = Int (0)
["Numcols":p rotected] = Int (0)
["Transtimes":p rotected] = Int (0)
["Error":p rotected] + string (0) ""
["LinkID":p rotected] = = Array (0) {
}
["_linkid":p rotected] = NULL
["Queryid":p rotected] = NULL
["Connected":p rotected] = bool (false)
["Autoinc":p rotected] = bool (false)
["Patchvalidate":p rotected] = bool (false)
------to solve the idea----------------------
# Picview Model initialization, if the Picview class exists, is called and initialized and, if not present, initializes the model based on the table name
$PicModel =d (' Picview ');
The SQL statement that #输出所有数据 actually executes is
# SELECT * from Picview
$s = $PicModel->select ();
PHP Beginners do not recommend looking directly at the frame!