php用while变成输出数组

2021-09-07  本文已影响0人  高坚果_
    public $name = "";
    public $id = '';
}
if($urlname == "GET"){
//    $data = "发起的是get请求";
    $sql = "SELECT * FROM `name_tetet`";
    $result = mysql_query($sql,$conn);
//    $fangData = mysql_fetch_array($result,MYSQL_ASSOC);

    while($ros = mysql_fetch_array($result)){
        $data[] = $ros;
    }
}else if ($urlname == "POST"){
    $data = "发起的是post请求";
}
$re = array("code"=>$code, "message"=>$message,"status"=>$status,"data"=>$data);
exit(json_encode($re));```
上一篇下一篇

猜你喜欢

热点阅读