【发布时间】:2016-06-12 04:13:33
【问题描述】:
$arr = array(
'toemail'=>$v->agent_primary_email,
'agentname'=>$v->agent_firstname,
'agentid'=>$v->agent_id,
'subject'=>'The details of total number of properties saved by your clients',
'totalprop'=>$v->prop_count
);
echo json_encode($arr);exit;
输出如下所示
{"toemail":"abc@gmail.com","agentname":"john","agentid":"110012","subject":"The details of total number of properties saved by your clients","totalprop":"131"}
但是我应该做些什么改变,让输出看起来像这样
{"toemail":"abc@gmail.com",
"agentname":"john",
"agentid":"110012",
"subject":"The details of total number of properties saved by your clients",
"totalprop":"131"}
【问题讨论】:
-
我的意思是我希望输出在每个对象中都有一个新行,而不是在一行中。
-
如果它只是用于输出样式,只需使用
JSON_PRETTY_PRINT标志。它已经在manual
标签: php arrays json codeigniter associative-array