0
我有一個簡單的數組,我從一些mysql結果在php中創建。json_encode正在切斷一些字符
數組中的數據示例如下,從數組的var_dump開始。
array(1) {
[0]=>
array(8) {
["value1a"]=>
string(2) "26"
["value3a"]=>
string(136) "Curriculum includes NCLEX prep work throughout all degree courses—preparing you to pass the NCLEX-RN exam and become a registered nurse."
["value3b"]=>
string(223) "$150 course fee includes: textbooks, ebooks and CDs, three sets of scrubs, all lab fees, stethoscope, bandage scissors, pen light, and your NCLEX application fee"
["soc_code"]=>
string(10) "29-1141.00"
["soc_title"]=>
string(17) "Registered"
["job_growth"]=>
string(2) "30"
["salary"]=>
string(5) "65950"
["program_name"]=>
string(20) "Professional"
}
}
當我做的陣列的json_encode如json_encode($results)
一切都很正常,但我對value3a值後1個字切斷。其餘的值都是它們應該包含的值,其中value3b與value3a一樣長。
下面是示例結果時,我贊同,因爲我不知道是什麼原因造成json_encode($results)
[{"value1a":"26","value3a":"Curriculum","value3b":"$150 course fee includes: textbooks, ebooks and CDs...etc
任何幫助,將不勝感激。我試圖從value3a的值中刪除第一個單詞,然後它仍然只列出一個單詞,現在是第二個單詞。
下面是我正在做的查看數據,所以我知道該數組在編碼之前沒有被更改。
echo "<pre>";
var_dump($results);
echo "</pre>";
echo json_encode($results);
你確定數組在你執行'json_encode'之前沒有被修改嗎? –
我確信這是在執行echo json_encode($ results)之前在$ results數組寫入var_dump的結果 – user1535268
看起來就像這個回聲「
」; echo json_encode($ results); – user1535268