当前位置: 首页 > 后端技术 > PHP

PHPfile_get_contents无法打开文件,json_decode问题

时间:2023-03-30 05:30:49 PHP

这是因为文件本身有BOM头,导致json_decode函数无法识别。您可以使用以下方法删除此标头。$data=json_decode(trim($fileSource,chr(239).chr(187).chr(191)),true);