A brief introduction to the usage of the at (@) symbol in PHP
for beginners in PHP, you often see a at (@) symbol before a function name, but it doesn't know its function and usage, and it seems to be puzzled by the fact that it has no effect on the program. It is simple to say that the @ can ignore the error and have the function of pitching error. Error control operator.
below to introduce its usage.
copy code code as follows:
[code]function db_connect () / / / / / / connection database
{
@$db =mysql_connect ('connection database failed! Please try again!
mysql_select_db ('book');
return $db;
}[/code]
if the connection to the database is not successful, the preceding "@" can display the error to the suppression, that is, not to display the error, and then throw out the exception, and display the unusual processing of its own definition, adding this only to let the browsers see it not to see The unfriendly page can not restrain the error, but only restrain the display error. @ used in places where you think there might be errors in the future, and a space after the @! It's better to use less, it seems to increase the cost of the system.