function is_json($str){ $jd = json_decode($str,true); if(is_null($jd)) return false; if(count($jd)>0) return true; //count($jd)==0时候,可能是[];如果不需要[]的数据,则可这样写,否则,直接返回true了 else return false; }
判断是否json数据
最新推荐文章于 2023-11-25 00:15:00 发布
function is_json($str){ $jd = json_decode($str,true); if(is_null($jd)) return false; if(count($jd)>0) return true; //count($jd)==0时候,可能是[];如果不需要[]的数据,则可这样写,否则,直接返回true了 else return false; }