The call time parameter program of the switch... case statement fails to solve the problem. Switch ..... the case statement has become the most common choice statement with high interest rates and convenience. as we all know about the stristr function, it is a good idea to combine the two statements to write parameters at the current time, solve the problem during debugging: & lt ;? Phpdate_default_timezone_set (AsiaShangHai); $ hd switch... case statement call time parameter program error solved.
Switch ..... the case statement has become the most common choice statement with high interest rates and convenience. as we all know about the stristr function, it is a good idea to combine the two statements to write parameters at the current time, solve the problem during debugging:
Date_default_timezone_set ("Asia/ShangHai ");
$ H = date ("H: I ");
Echo $ h; // output the current time;
Switch ($ h ){
Case ""; // you can take any time for debugging;
If ($ k = "12:00 ");
If (stristr ($ k, $ h )! = "");
Echo "successful ";
Break;
Case "12: 01 ";
If ($ k = "12:01 ");
If (stristr ($ k, $ h )! = "");
Echo "succeeded again ";
Break;
Default:
Echo "failed ";
}
?>
Errors occur frequently during debugging. please answer the question. thank you.
------ Solution --------------------
You $ h = date ("H: I ");
There is a space before the time.
So it will not enter any branch like case "12:01"; because there is no leading space