我的项目存在很大问题。
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.deutschebahn.com/fasta/v2/facilities?
type=ELEVATOR&stationnumber=1401",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => array(
"authorization: Bearer XXX",
"cache-control: no-cache"
),
));
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
$result = json_decode($response, true);
$lift_status[4] = $result['5']['state'];
$lift_status[5] = $result['5']['state'];
$lift_status[6] = $result['6']['state'];
$lift_status[7] = $result['6']['state'];
$lift_status[9] = $result['7']['state'];
$lift_status[10] = $result['7']['state'];
$lift_status[11] = $result['2']['state'];
$lift_status[12] = $result['2']['state'];
$lift_status[13] = $result['3']['state'];
$lift_status[14] = $result['3']['state'];
$lift_status[15] = $result['4']['state'];
$lift_status[16] = $result['4']['state'];
$lift_status[17] = $result['0']['state'];
$lift_status[18] = $result['0']['state'];
$lift_status[19] = $result['1']['state'];
$lift_status[20] = $result['1']['state'];
这些是电梯,$ lift_status [4]是电台的轨道。结果将是ACTIVE或INACTIVE。
我有第二个页面,其中包含一些曲目列表。
例如(state = ACTIVE)
<span class="badge badge-lg badge-primary">Track 4</span>
<span class="badge badge-lg badge-primary">Track 11</span>
<span class="badge badge-lg badge-primary">Track 7</span>
<span class="badge badge-lg badge-primary">Track 20</span>
现在(州=非活动
<span class="badge badge-lg badge-danger">Track 4 <i class="fa fa-exclamation-triangle"></i></span>
<span class="badge badge-lg badge-danger">Track 11 <i class="fa fa-exclamation-triangle</span>
<span class="badge badge-lg badge-danger">Track 7 <i class="fa fa-exclamation-triangle</span>
<span class="badge badge-lg badge-danger">Track 20 <i class="fa fa-exclamation-triangle</span>
有谁知道如何解决我的问题?
提前致谢 丹尼斯
答案 0 :(得分:0)
我想改变(实时)
<span class="badge badge-lg badge-primary">Track 4</span>
到
<span class="badge badge-lg badge-danger">Track 4 <i class="fa fa-exclamation-triangle"></i></span>
当状态从ACTIVE变为INACTIVE
时