為什么輸出還是2300,月份的判定沒有嗎?
<?php
??? $totalMoney = 0;//總工資
??? $basicMoney =? 2000;//基本工資
??? $month=0;
?$sex = "女";
? if($sex=="男"){
??$totalMoney = $basicMoney? + 0;// 男的沒獎金
???? }else if(date('m',time()=='11') and $sex=="女")
???? {
??$totalMoney = $basicMoney? + 300;// 女的有獎金300元
??$month=date('m',time());
???? }
?echo $totalMoney;
?echo $month;
?>
為什么還是輸出2300?
2018-01-01
你可以查一下php的date()這個方法,我查了一下,date() 函數格式化本地日期和時間,并返回已格式化的日期字符串。應該是這樣用,else if(date('m',time()) == '11' and $sex == “女"),可能是你要的結果。http://www.w3school.com.cn/php/func_date_date.asp
2018-01-12
括號位置問題 第二個elseif你仔細看下
2018-01-02
朋友這個只是你判斷語句寫錯了??else if(date('m',time()=='11') and $sex=="女") 改成?
else if(date('m',time())=='11' and $sex=="女")
2017-12-29
設置了第二個IF語句,else if(date('m',time()=='11') and $sex=="女")
兩個條件要都成立,才執行累加,為什么當前月份是12月,也會執行呢?
2017-12-28
.....