Add Additional Objects to JSON Encoded Array

后端 未结 4 935
名媛妹妹
名媛妹妹 2021-02-06 04:21

I am currently using a JSON encoded array to display the users in my database for an auto-suggest feature.

It looks something like this:

$sth = mysql_que         


        
4条回答
  •  长发绾君心
    2021-02-06 04:22

    Try in this way:-

    $temp = json_encode($json);  //$json={"var1":"value1","var2":"value2"}   
    $temp=substr($temp,0,-1);
    $temp.=',"variable":"'.$value.'"}';
    

提交回复
热议问题