mysql中时间字段datetime怎么判断为空和不为空一般为空都用null表示,所以一句sql语句就可以.select * from 表名 where 日期字段 is null;这里要注意null的用法,不可以用=null这样的形式表示.相反,要取出不为空的数据,就是is trueselect * from 表名 where 日期字段 is true;
手册查询array_filter()的使用细节时,看到了:If no callback is supplied, all entries of input equal to FALSE (see converting to boolean) will be removed. 如果没有给出回调函数,所有的等于 FALSE 的元素将会被移除掉! 刚好可以用来移除数组中的空元素! 使用:$arr = array_filter($arr); <?php $arr=array(1,2,3,null,'',