I'm actually calling a Zend database access method, using the Fetchall method, but because the record is not in the database, the returned object is null, so I'm going to determine if the object is null:
Copy Code code as follows:
so write the result, is to produce the above that notice, also really strange, the object is null, unexpectedly can't visit?
search data, found that judge is null, need to judge this:
Copy Code code as follows:
if (Isset ($obj)) {
echo "This var is set set and so I'll print.";
}
What does this isset do?
The
isset function is to detect whether the variable is set.
format: bool Isset (mixed var [, mixed Var [, ...]])
return Value:
returns FALSE If the variable does not exist
returns FALSE if the variable exists and its value is null
if the variable exists and the value is not NULL, return ture
When you check multiple variables at the same time, each item returns TRUE when it meets the previous requirement, otherwise the result is FALSE
If you have freed a variable using unset (), it will no longer be isset (). If you use Isset () to test a variable that is set to NULL, it returns FALSE. Also note that a null byte ("\0″") is not equivalent to PHP's null constant.
Warning: isset () can only be used for variables because passing any other parameter will result in a parse error. To detect if a constant is set, use the defined () function.
It seems that the problem with my judgment just now is that this "is a null byte (" \0″ "is not equivalent to the null constant of PHP).