可能重复:
Reference - What does this symbol mean in PHP?
What is the ?: Operator and what does it do?
The three different equals (=, ==, ===)
有人可以解释一下这是如何运作的吗?
$xblgold = $xblgold == 1 ? "Yes" : "No";
echo $xblgold;
答案 0 :(得分:0)
这是另一种if else
构造。
你也可以这样写:
if($xblgold == 1) {
$xblgold == "Yes";
} else {
$xblgold == "No";
}
答案 1 :(得分:0)
与
相同if($xblgold == 1){
$xblgold = "Yes";
}else{
$xblgold = "No";
}