How does thinkPHP5 return an empty model object?

for example, define a data model class Employee

class Employee extends thinkModel

then add a public static function Search () to the class

use the where () method when querying, and then return the paged data model object.

< hr >

but there is a problem, that is, empty data model objects need to be returned under certain conditions. Because the upper layer code also needs to use some methods of the model class, it will make an error if you return a null, upper layer call directly. How to return an empty model object?

clipboard.png

Php
Jun.02,2021

return this;


return new static;
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b37e82-2ae15.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b37e82-2ae15.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?