Usage of the phpat (@) symbol. The following describes its usage. for example, the copy code is as follows: functiondb_connect () connects to the database {@ $ dbmysql_connect (localhost, root, test); if (! $ Db) thrownewExcept The following describes its usage.
For example:
The code is as follows:
Function db_connect () // connect to the database
{
@ $ Db = mysql_connect ('localhost', 'root', 'test ');
If (! $ Db)
Throw new Exception ('failed to connect to the database! Please try again! ');
Mysql_select_db ('book ');
Return $ db;
}
If the connection to the database fails, the previous "@" will be able to suppress the error, that is, it will not display the error, and then throw an exception to display its own exception handling, this is just to make the page viewer invisible. unfriendly pages cannot suppress errors, but can only Suppress display errors! @ Is used in the place where you think an error may occur in the future. @ a space will be placed next to it! It is better to use less, as if to increase the system overhead.
Example: Code: function db_connect () // connect to the database {@ $ db = mysql_connect ('localhost', 'root', 'test'); if (! $ Db) throw new partition t...