Everyone in the PHP project, there are always some code line preceded by the @ symbol, we all know what it means? Here to share the function of the pre-match @ in PHP
If you use it today, just remember it. In fact, it is the error control character, even if there is an error, but also ignore the error message, continue to execute the code below.
Copy Code code as follows:
@ $page =$_get[' page ']?intval ($_get[' page ']): 1;
The sentence is to get the value of the page keyword from the URL, such as "Index.php?page=5", then the $page will take 5.
However, if there is error, such as "index.php" After no page keyword, if you go to fetch $_get[' page ' does not exist will be an error, then have @ can ignore this small mistake.
Another example:
Copy Code code as follows:
$conn = Mysqli_conncet ("Q", "W", "E", "R");
This will enter an error message about the connection to the database.
Copy Code code as follows:
@ $conn = Mysqli_conncet ("Q", "W", "E", "R");
If $conn in front of the @ can not let him output the error message.
Just remember it here.
The above is PHP plus at the @ in accordance with the role of interpretation, I hope you like.