我需要在我的表中使用if语句,行的值是"Released“,但我想在html表上显示Pending。我如何才能做到这一点。这是我当前的代码。我的if语句有什么问题?
if (strlen($row['signed']) == "Released") {
echo "Pending";
}
else{
echo $row['signed'];
}发布于 2016-03-07 20:51:21
strlen()用于计算字符串的长度,要检查它是否与"Released"匹配,只需使用==进行比较:
if ($row['signed'] == "Released") {
echo "Pending";
} else {
echo $row['signed'];
}要查看是否设置了$row['signed'],只需使用isset()
if (isset($row['signed'])) {
echo "Pending";
} else {
echo $row['signed'];
}有关isset()的更多信息,请访问:http://php.net/manual/en/function.isset.php
有关PHP运算符的更多信息:http://php.net/manual/en/language.operators.php
https://stackoverflow.com/questions/35844064
复制相似问题