快速问题我真的需要一些帮助,我重新格式化了一些 json 以将其转换为 javascript var,我让它与 json_encode 一起工作,但我需要它输出 ' 符号而不是 " 符号,有没有办法做到这一点
我需要它是这样的(使用'符号)
{
title:'Greeting',
mp3:'http://www.godsgypsychristianchurch.net/music/Atlanta%20GA/Dey%20duma%20amensa/01%20Greeting.mp3',
buy:'http://www.godsgypsychristianchurch.net/music/Atlanta%20GA/Dey%20duma%20amensa/01%20Greeting.mp3',
price:'Download',
duration:'',
cover:'http://godsgypsychristianchurch.net/music_artwork/DEFAULT_COVER.png'},
我的代码:
foreach ($json['rows'] as $row) {
if ($_GET['churchname'] == $row[doc]['album']) {
$songCount = 0;
foreach ($row['doc']['tracks'] as $song) {
++$songCount;
$arr = array(
"title" => "{$song['name']}",
"mp3" => "{$songUrl}",
"buy" => "{$songUrl}",
"price" => "Download",
"duration" => "",
"cover" => "{$row['doc']['artwork']}",
);
echo json_encode($arr);
}
}
}
exit;