㈠ php怎麼將數據做成json的格式給前端使用
用json_encode()函數將數據編碼,然後就是json格式的數據了。
$data=['status'=>0,'msg'=>'操作成功'];$json=json_encode($data);echo$json;