php json_encode方法 报错:Inf and NaN cannot be JSON encoded
json_encode 返回false
var_dump(json_encode($array));
通过json_last_error_msg查看报错原因
echo json_last_error_msg();
Inf and NaN cannot be JSON encoded
原因是$array里面包含了NAN 和INF 这些导致的
解决方案如下:
echo json_encode(unserialize(str_replace(array('NAN;','INF;'),'0;',serialize($infos))));
php json_encode方法 报错:Inf and NaN cannot be JSON encoded相关推荐
- 报错SyntaxError: Unexpected token T in JSON at position 0 at JSON.parse (<anonymous>)的解决方法
报错SyntaxError: Unexpected token T in JSON at position 0 at JSON.parse ()的解决方法 刚刚开始学习node.js会报很多各种各样的 ...
- 93.<报错 SyntaxError: Unexpected token R in JSON at position 0 at JSON.parse (<anonymous>)的解决方法>
@[TOC]( 报错 SyntaxError: Unexpected token R in JSON at position 0 at JSON.parse ()的解决方法) 报错代码: const ...
- 报错 SyntaxError: Unexpected token R in JSON at position 0 at JSON.parse (<anonymous>)的解决方法
报错 SyntaxError: Unexpected token R in JSON at position 0 at JSON.parse ()的解决方法 报错代码: let articles = ...
- webpack基础,运行webpack-dev-server报错,Cannot find module WebpackOptions.json
最近项目不忙,所以看看webpack的基础,在跟着官网走到dev-server的时候,按照教程,配置,执行命令cnpm start的时候报错,错误如下 packge.json文件的配置信息: 我的we ...
- 如何安装kaggle API下载数据 及报错OSError: Could not find kaggle.json. Make sure it‘s located in /home/user/解决办法
如何安装kaggle API下载数据 及报错OSError: Could not find kaggle.json. Make sure it's located /解决办法 C:\Users\pc& ...
- 关于:js使用$.parseJSON字符串转json对象报错Uncaught SyntaxError- Unexpected token o in JSON at position 1
今天使用js使用$.parseJSON字符串转json对象报错Uncaught SyntaxError- Unexpected token o in JSON at position 1,一直找不到原 ...
- WEEX 报错 TypeError: Converting circular structor to JSON 的解决方法
背景 在进行千牛QAP插件开发的时候,有时会遇到 TypeError: Converting circular structor to JSON,并且看不到报错位置,对新手可能会造成疑惑. 原因 we ...
- 报错:Collecting package metadata (current_repodata.json): failed
报错Collecting package metadata (current_repodata.json): failed 如果尝试了博客的方法,还是无效的话,Collecting package m ...
- python response.json()报错_Django JsonResponse json格式报错 解决Django响应JsonResponse返回json格式数据报错问题...
想了解解决Django响应JsonResponse返回json格式数据报错问题的相关内容吗,彭世瑜在本文为您仔细讲解Django JsonResponse json格式报错的相关知识和一些Code实例 ...
- laravel的composer require报错:Installation failed, reverting ./composer.json to its original content.
一.前言 查看laravel文档的时候,看到Laravel Passport 实现 API 认证这个是真不错,但是本地实际安装的时候,一直安装不上,报错信息如标题所述,这就很烦人了,下面记录一下解决过 ...
最新文章
- Strategy模式与Delegate委托
- 修改oracle数据库密码
- 类的初始化(构造函数)
- EFCore动态切换Schema
- 【C++grammar】访问控制与抽象类与纯虚函数
- 自定义注解与validation结合使用案例
- java 爬 维基百科_爬取维基百科词条
- node2vec的一些理解
- elasticsearch所有版本的x-pack-sql-jdbc下载地址
- TBase开源版V2.1.0 集群搭建部署完整版
- Pycocotools 报error: Microsoft Visual C++ 14.0 or greater is required. Get it with “Microsoft C++ Bui
- windows日志文件查看与清理
- 3个超神器工具,让你的电脑比手机好玩,值得收藏
- 流程发现算法第1讲| Alpha算法
- 随机过程 自相关函数 互相关函数自协方差矩阵 互协方差矩阵的区别联系
- 几何轮廓产生序列,时间产生色。(解法一)
- 关于matlab求含有nan矩阵的均值
- Scaffold 详解
- 苹果电脑设置不锁屏的方法
- 解决报错:metadata for UsersEntity#photos was not found. Check if you specified a correct entity xx