/*json */
function my_arr_zhuan_json($arr)
{
$jsonstr = $this->my_json_decode(json_encode($arr,true));
$new_jsonstr = $this->decodeUnicode($jsonstr);
$str1 = str_replace("name:","name:'",$new_jsonstr);
$str2 = str_replace(",data","',data",$str1);
return $str2;
}
/*json */
function my_json_decode($str) { //
$str = preg_replace('#"(.*?)"#i', '$1$2', $str); //
return $str;
}
/*json key */
function my_json_decode($str) { //
$str = preg_replace('/"(\w+)"(\s*:\s*)/is', '$1$2', $str); // key
return $str;
}
/*json */
function decodeUnicode($str)
{
return preg_replace_callback('/\\\\u([0-9a-f]{4})/i',
create_function(
'$matches',
'return mb_convert_encoding(pack("H*", $matches[1] ), "UTF-8", "UCS-2BE");'
),
$str);
}