2012-01-12 281 views

回答

5

與嘗試代碼:

$pl2 = json_encode(array(
    'comment' => $nmp3, 
    'file' => $pmp3 
)); 
+0

你在那裏混合使用javascript語法......它應該是'=>'而不是':'= p – 2012-01-12 15:37:35

+0

這有效。謝謝。但爲什麼它將變量值(這是一個路徑)更改爲\/users \/crazy_bash \/online \/test \ / – 2012-01-12 15:48:58

0

試試這個,它應該工作:

$p = ' {"comment": ' . $nmp3; 
$p = $p.' "," file " : " ' . $pmp3; 
$p=$p.' "}," '; 
echo $p;