我输出一些数据作为JSON,我试图用HTML标签替换输出中的括号'[']:
$qq = json_decode($html, true);
$qq2 = str_replace("[","<span>",$qq);
print_r($qq2);
它无法正常工作,这意味着无论如何都会显示括号,并且不会被替换。 示例输出:
[2] => Array
(
[image] => http://rack.0.mshcdn.com/james-clapper.jpg
[query] => (max-width: 480px)
[size] => 80x80#
)
我想将括号替换为html标签,以便输出 是:
[2] => Array
(
<span> image </span> => http://rack.0.mshcdn.com/james-clapper.jpg
<span> query </span> => (max-width: 480px)
<span> size </span> => 80x80#
)