如:$task_phase_conf_json = json_encode($task_phase_conf);
var task_phase_conf = eval({$task_phase_conf_json});
if(json.status === undefined){
for(var i=0;i<json.length;i++){
$('#info_ul').append('<li style="width:200px;float:left;"><input type="checkbox" name="ids[]" value="'+json[i]['uid']+'">'+json[i]['username']+'</li>');
}
}else if(json.status==2){
art.dialog.alert(json.msg);return false;
}
} ,'json')
if(!$user_info){
kekezu::echojson('查無此人','2');die();
}else{
echo JSON($user_info);die();
}
*
* 將數組轉換爲JSON字符串(兼容中文)
* @param array $array 要轉換的數組
* @return string 轉換得到的json字符串
* @access public
*
* *********************************************************** */
function arrayRecursive(&$array, $function, $apply_to_keys_also = false) {
static $recursive_counter = 0;
if (++$recursive_counter > 1000) {
die('possible deep recursion attack');
}
foreach ($array as $key => $value) {
if (is_array($value)) {
arrayRecursive($array[$key], $function, $apply_to_keys_also);
} else {
$array[$key] = $function($value);
}
if ($apply_to_keys_also && is_string($key)) {
$new_key = $function($key);
if ($new_key != $key) {
$array[$new_key] = $array[$key];
unset($array[$key]);
}
}
}
$recursive_counter--;
}
function JSON($array) {
arrayRecursive($array, 'urlencode', true);
$json = json_encode($array);
return urldecode($json);
}