<?php
$json = '{"meAccessTotal":"%s", "sysMsgTotal":"%s", "meSendTotal":"%s", "meAcceComAdminTotal":"%s", "meAcceComUserTotal":"%s",
"meAcceUserTotal":"%s", "maxPage":"%s", "msgList":"%s"}';
$output = iconv('gbk', 'UTF-8', $this->tpl->fetch('user/usermsg_ajaxmsgs.htm'));
//remove enter
$output = preg_replace("/[\s]{2,}/","",$output);
//remove double quotes to single quotes
$output = str_replace("\"","'",$output);
//这是接收信息界面,各项值和msglist
if (empty($send))
{
echo sprintf($json, $totalArr['meAcceTotal'], $totalArr['sysMsgTotal'], $totalArr['meSendTotal'], $totalArr['meAcceComAdminTotal'],
$totalArr['meAcceComUserTotal'], $totalArr['meAcceUserTotal'], $maxPage, $output);
exit;
}
?>
json to array
<?php
//json json转成数组
$arr = json_decode($jsonstr);