I now have three pieces of data, one of which is bid_status=1. How can I only show it as 1? on the contrary, if it is not equal to 1, I will show all data equal to 0, which belongs to php. The printed data is json, regardless of format
."baojia": [
{
"bid_price": "*****",
"bid_status": "0",
"store_logo": "https://img.qcpjpt.com/20180818/1534584899_792.png",
"store_name": "",
"store_credit": 0
},
{
"bid_price": "*****",
"bid_status": "0",
"store_logo": "https://img.qcpjpt.com/20180814/1534238896_521.jpg",
"store_name": "",
"store_credit": 0
},
{
"bid_price": "*****",
"bid_status": "1",
"store_logo": "https://img.qcpjpt.com/Public/uploads/20180530/%E5%BE%AE%E4%BF%A1%E5%9B%BE%E7%89%87_20180530140423.jpg",
"store_name": "",
"store_credit": 100
}
],
related codes
/ / Please paste the code text below (do not replace the code with pictures)
//
$arr = [];
$arr_ = [];
foreach ($quoted_price as $key => $value) {
if( $request->param("user_id") != $reg["user_id"] ){
$arr[$key]["bid_price"] = "*****";
} else {
$arr[$key]["bid_price"] = $value["bid_price"];
}
if( $value["bid_status"] == 0 ){
$arr[$key]["bid_status"] = "0";
} else {
$arr[$key]["bid_status"] = "1";
}
$arr[$key]["store_logo"] = $value["store_logo"];
$arr[$key]["store_name"] = $value["store_name"];
$arr[$key]["store_credit"] = $value["store_credit"];
if( !empty($value["bid_status"]) == 1 ){
$arr_ = $value["bid_status"];
}
}
$data["baojia"] = empty($arr) ? "" : $arr ;