我有這個說法有些問題,PHP if/else語句的問題
<?php
$cert_mess = $vehicle['make'];
if ($vehicle["make"] == "Honda" && $vehicle["Certified"] == "0") {
$cert_mess = "DFWCertAutos";
}
elseif ($vehicle["make"] == "Cadillac" && $vehicle["Certified"] == "0") {
$cert_mess = "DFWCertAutos";
}
elseif (!in_array($vehicle['make'], array('Cadillac','Honda'))) {
$cert_mess = "DFWCertAutos";
}
?>
<div style="font-size:10px; padding:10px; padding-top: 0px;">*This car is <?php
echo $cert_mess ?> certified.</div>
有什麼建議?目前它只顯示$cert_mess
爲'make'並忽略if/else if語句。
也許不關你的if語句由於執行壞邏輯是什麼?你甚至試圖調試它? –
你的意見是什麼? 'var_dump($ vehicle)' –
你確定在'beginnig'中設置了$ vehicle ['make']'嗎? – Hindol