PHP的print_rJavascript函数输出JSON数据

复制代码代码如下所示:
/ / theob(JSON数据)
功能print_r(theobj){
无功retstr =;
如果(typeof theobj = = 'object){
retstr + =;
对于(VAR P theobj){
如果(typeof theobj { p } = = 'object){
retstr ={+ P + } = > +类型+(theobj);
retstr + = + +(P print_r theobj { });
{ { { }
retstr ={+ P + P + theobj } { } += >;
}
}
retstr + =;
}
返回retstr;
}