Array
(
[sEcho] => 1
[iTotalRecords] => 7521
[iTotaldisplayRecords] => 1
[aaData] => Array
(
[0] => Array
(
[0] => nordic Capital Buys SiC Processing
[1] => 2010-06-21/nordic-capital-buys-sic-processing
[2] => PEHub Media
[3] => Business
[4] => completed
[5] => nordic Capital has acquired a 70% stake in SiC Processing AG,a German industrial recycling company,from Frog Capital. No sale price was disclosed. SiC Processing’s founding family retains a 25% holding,while former lead investor Zouk Ventures retains a 5% stake.
[6] => Admin,China,Frog Capital,Germany,Italy,Iyad Omari,Manufacturing,norway,PEHub Media,Photovoltaic Wafer Manufacturing,Renewable Energy,Semiconductor,United States
)
)
)
echo json_encode($myArr);
{“sEcho”:”1″,”iTotalRecords”:7521,”iTotaldisplayRecords”:”1″,”aaData”:[[”
nordic Capital Buys SiC Processing</a></div>”,”
2010-06-21/nordic-capital-buys-sic-processing</div>”,”PEHub Media”,”Business”,”completed”,null,”
Admin,United States]]}
注意完成后字符串中间的null
为什么这样,我需要执行什么转义/操作才能对其进行编码?
我试过,addslashes
从手册:
Note that if you try to encode an
array containing non-utf values,
you’ll get null values in the
resulting JSON string. You can
batch-encode all the elements of an
array with the array_map function:
$encodedArray = array_map(utf8_encode,$myArr); echo json_encode($encodedArray);