Jon _ encode
空值
整数、浮点、布尔
string encoded as UTF-8
对象简化jsonserializable (orwhateverit ' s called,I'm too lazy to look it up ) )。
arrays of JSON-encodable objects
stdclassinstancesofjson-encodableobjects
json_encode中所有字符串数据的编码必须为UTF-8,否则返回false
json_last_error_msg允许您显示最新的分析错误
转换utf8函数
functionconverttoutf8($text ) {
$ encoding=MB _ detect _ encoding ($ text,mb_detect_order ),false );
if($encoding=='UTF-8 ' )
{
$ text=MB _ convert _ encoding ($ text,' UTF-8 ',' UTF-8 ' );
}
$out=iconv(MB_detect_encoding )、mb_detect_order )、false )、' UTF-8//IGNORE '、$text );
返回$ out;
}