我想我的數組轉換成字符串,我的意思是我想呼應僅數組值我的結果數組轉換成字符串在PHP
我用這個代碼
$query = "SELECT `message` FROM `appstickers`";
$result = $mysqli->query($query) or die($mysqli->error.__LINE__);
$jsonArray = array();
while($row = $result->fetch_assoc()) {
$jsonArray[]= $row;
}
//echo $string;
echo json_encode($jsonArray);
我得到這個輸出
[{"message":"welcome to team with us"},{"message":"this is for light dispatch"}]
,但我想這個輸出
[歡迎團隊與我們合作,這是光調度「]
所以請給我一份有例如
你爲什麼要使用json_encode()
你所需的輸出是沒有意義的,它只是一個串連字符串數組 – NDM