PHP与js使用json交互
$m_register_array = array(); $m_register_json = urlencode(iconv("GB2312","UTF-8",json_encode($m_register_array))); PHP代码
function URLdecode(str) { var ret = ""; for(var i=0;i<str.length;i++) { var chr = str.charAt(i); if(chr == "+") { ret += " "; }else if(chr=="%") { var asc = str.substring(i+1,i+3); if(parseInt("0x"+asc)>0x7f) { ret += decodeURI("%"+ str.substring(i+1,i+9)); i += 8; }else { ret += String.fromCharCode(parseInt("0x"+asc)); i += 2; } }else { ret += chr; } } return ret; }
var styleJson = eval(URLdecode("<?php echo $m_register_json ?>")); //比赛类型json数据 js代码
相关推荐
zyyjay 2020-11-09
xuebingnan 2020-11-05
samtrue 2020-11-22
stefan0 2020-11-22
yifangs 2020-10-13
songshijiazuaa 2020-09-24
hebiwtc 2020-09-18
天步 2020-09-17
83911535 2020-11-13
whatsyourname 2020-11-13
zhouyuqi 2020-11-10
Noneyes 2020-11-10
mathchao 2020-10-28
王志龙 2020-10-28
wwwsurfphpseocom 2020-10-28
diskingchuan 2020-10-23
savorTheFlavor 2020-10-23