JSON函数

Wesley13
• 阅读 440
string json_encode ( mixed $value [, int $options = 0 [, int $depth = 512 ]] )
//*arrays are returned only if you don't define index.


mixed json_decode ( string $json [, bool $assoc = false [, int $depth = 512 [, int $options = 0 ]]] )
//*这个函数仅能处理 UTF-8 编码的数据。
//*当assoc参数为 TRUE 时,将返回 array 而非 object 。
//*Any subsequent key named "_empty_" (or "" [the empty string] again) will overwrite the value.
//*where /\ is the string which doesn't worked.

string json_last_error_msg ( void )
/*
JSON_ERROR_NONE => 'No error',
JSON_ERROR_DEPTH => 'Maximum stack depth exceeded',
JSON_ERROR_STATE_MISMATCH => 'State mismatch (invalid or malformed JSON)',
JSON_ERROR_CTRL_CHAR => 'Control character error, possibly incorrectly encoded',
JSON_ERROR_SYNTAX => 'Syntax error',
JSON_ERROR_UTF8 => 'Malformed UTF-8 characters, possibly incorrectly encoded'
*/

int json_last_error ( void )
/*
0 = JSON_ERROR_NONE 没有错误发生
1 = JSON_ERROR_DEPTH 到达了最大堆栈深度
2 = JSON_ERROR_STATE_MISMATCH 无效或异常的 JSON
3 = JSON_ERROR_CTRL_CHAR 控制字符错误,可能是编码不对
4 = JSON_ERROR_SYNTAX 语法错误
5 = JSON_ERROR_UTF8 异常的 UTF-8 字符,也许是因为不正确的编码。
*/
点赞
收藏
评论区
推荐文章
blmius blmius
2年前
MySQL:[Err] 1292 - Incorrect datetime value: ‘0000-00-00 00:00:00‘ for column ‘CREATE_TIME‘ at row 1
文章目录问题用navicat导入数据时,报错:原因这是因为当前的MySQL不支持datetime为0的情况。解决修改sql\mode:sql\mode:SQLMode定义了MySQL应支持的SQL语法、数据校验等,这样可以更容易地在不同的环境中使用MySQL。全局s
Wesley13 Wesley13
2年前
java判断字符串是否为数字或中文或字母
1.判断字符串是否仅为数字:1用JAVA自带的函数public static boolean isNumeric(String str){  for (int i  str.length();i0;){      if (!Character.isDigit(str.charAt(i))){
ThinkPHP V5.0 图片上传base64
/单图上传@returnbool|mixed|string/protectedfunctionuploadingqrcode($images'',$name'')if(empty($images))$thisresult($images,0,'图片错误');if(pregmatch('/^(data:\simag
Stella981 Stella981
2年前
SpringBoot整合Redis乱码原因及解决方案
问题描述:springboot使用springdataredis存储数据时乱码rediskey/value出现\\xAC\\xED\\x00\\x05t\\x00\\x05问题分析:查看RedisTemplate类!(https://oscimg.oschina.net/oscnet/0a85565fa
Stella981 Stella981
2年前
HIVE 时间操作函数
日期函数UNIX时间戳转日期函数: from\_unixtime语法:   from\_unixtime(bigint unixtime\, string format\)返回值: string说明: 转化UNIX时间戳(从19700101 00:00:00 UTC到指定时间的秒数)到当前时区的时间格式举例:hive   selec
Wesley13 Wesley13
2年前
Jdk 6 学习记录
java.util.Arrays 类// 自然排序Arrays.sort(Object obj);// 自然排序,在指定范围内Arrays.sort(Object obj,int fromIndex,int toIndex);// 在数组中找指定Key,返回索引(
Easter79 Easter79
2年前
SpringBoot整合Redis乱码原因及解决方案
问题描述:springboot使用springdataredis存储数据时乱码rediskey/value出现\\xAC\\xED\\x00\\x05t\\x00\\x05问题分析:查看RedisTemplate类!(https://oscimg.oschina.net/oscnet/0a85565fa
Stella981 Stella981
2年前
JVM 字节码指令表
字节码助记符指令含义0x00nop什么都不做0x01aconst\_null将null推送至栈顶0x02iconst\_m1将int型1推送至栈顶0x03iconst\_0将int型0推送至栈顶0x04iconst\_1将int型1推送至栈顶0x05ic
Wesley13 Wesley13
2年前
mysql select将多个字段横向合拼到一个字段
表模式:CREATE TABLE tbl_user (  id int(11) NOT NULL AUTO_INCREMENT,  name varchar(255) DEFAULT NULL,  age int(11) DEFAULT NULL,  PRIMARY KEY (id)
Wesley13 Wesley13
2年前
MySQL部分从库上面因为大量的临时表tmp_table造成慢查询
背景描述Time:20190124T00:08:14.70572408:00User@Host:@Id:Schema:sentrymetaLast_errno:0Killed:0Query_time:0.315758Lock_