美文网首页PHP
file_get_contents()读取后json_decod

file_get_contents()读取后json_decod

作者: 一名鼻炎患者 | 来源:发表于2017-06-28 18:05 被阅读0次
#1.查看源代码如果有html代码可以使用htmlspecialchars(字符串)或strip_tags(字符串)去除html标记
#2.查看源代码如果没有html代码,可是转换不成数组,那就是含有bom头了($data就是读取到的字符串)
   
 #去除BOM头
   $BOM = chr(239).chr(187).chr(191); 
   $data=str_replace($BOM,'',$data); 
   $data=json_decode($data,true);

相关文章

网友评论

    本文标题:file_get_contents()读取后json_decod

    本文链接:https://www.haomeiwen.com/subject/bczucxtx.html