Generally, we will write as follows:
Copy codeThe Code is as follows:
<?
If ($ _ GET ['time'] = null)
{
$ Time = time ();
}
Else
{
$ Time = $ _ GET ['time'];
}
Echo $ time;
// If GET has time, the variable time is included. If not, the current time () time is included.
?>
If you only make a simple judgment, it will be too troublesome to write as above, and the efficiency is not high!
You can change it to the triplicate method:
Copy codeThe Code is as follows:
<?
$ Time = ($ _ GET ['time'] = null )? (Time (): ($ _ GET ['time']);
Echo $ time;
?>
Concise!
I would like to explain the meaning of a trigger.
If the sentence in the first parentheses () is true, the question mark is executed? If the content of the first parentheses () is not true, the question mark is executed? Content of the second bracket ()
Copy codeThe Code is as follows:
<?
$ A = 5; // define variable a = 5
$ B = 3; // define variable B = 5
$ C = ($ a = $ B )? ("Yes"): ("no ");
// If a = B, c = yes; a is not equal to B, c = no
?>
There is also a simplified
Copy codeThe Code is as follows:
$ Bool = true;
If ($ bool)
{
SetValueFun ();
}
Can be simplified
Copy codeThe Code is as follows:
$ Bool & setValueFun ();