A brief introduction to the usage of the at (@) symbol in PHP

time:13-04-09 forum:PHP tools and code
  Reprinted from http://www.jb51.net/article/19084.htm

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.

prev:China's first full-length fairy tale "li... next:PHP force download file (click TXT file,...
post comment
Notice



approved   PhpBB official support station (Engl...   A brief introduction to the usage of...         
rand   PHP cURL to achieve simulation login...   PHP curl function simulated crawler ...   Using CURL instead of file_get_conte...   Use.Htaccess to prevent images from ...   Encryption and decryption of PHP fil...
ads

other

Because all the contents of this site are reproduced from other media, the intention is to provide free services to the public, but it does not mean that this site agrees with its views, and can not be responsible for the authenticity of its verification, such as the copyright unit or individual of the manuscript does not want to publish on this site, please Contact me, I will immediately remove it, thank you. Contact: atseashawk@163.com