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;
Menu