public function test(){
$test = "";
if($test==null){
echo "test==null <hr>";
}else{
echo "test!=null <hr>";
}
if(empty($test)){
echo "test is empty <hr>";
}else{
echo "test is not empty <hr>";
}
$test1 = null;
if(empty($test1)){
echo "null is empty <hr>";
}else{
echo "null is not empty <hr>";
}
//null == "" == empty
}
结果:
test==null
test is empty
null is empty
注:""表示字符串类型的空