php json_encode 中文null

PHP JSON Encode
本文解决PHP中使用json_encode遇到中文字符变为null的问题。介绍通过iconv函数将字符串从GBK编码转换为UTF-8编码来确保中文字符能正确被json_encode处理。
php json_encode 中文null
更多内容请看:[url="http://www.yoewan.com"]yoewan分享[/url],[url="http://www.yoewan.com/flex"]Flash教程[/url],[url="http://www.yoewan.com/jsfl"]JSFL教程[/url]
转载自:[url="http://www.yoewan.com/php-the-json_encode-chinese-null.html"]http://www.yoewan.com/php-the-json_encode-chinese-null.html[/url]

今天在使用php json_encode的时候发现中文都是null,后来上网查询了下,在使用json_encode的时候,中文先要编一下码,否则会为null,代码如下

//中文编码
$data=iconv('gbk','utf-8','yoewan分享');

标签:yoewan.com,php json_encode 中文null
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值