我从一个网站上看到了一段代码,是用php写的。在code变量中,前面写着@ symbol,这是什么意思,例如:
@hello = "hi";
发布于 2012-03-23 16:21:38
@是PHP中的错误抑制操作符。
PHP supports one error control operator: the at sign (@).
When prepended to an expression in PHP, any error messages that might be
generated by that expression will be ignored.编辑:
典型用法包括:
<?php
// Usage of the @ symbol in PHP code
// Typical Example
$var = @some_function();
// Class/Object Example
$var = @new some_class();
// Does NOT Work!
//$var = new @some_class(); // syntax error
// Another example. Very slow
$var = @$some_var;
?>请参阅以下链接:
http://php.net/manual/en/language.operators.errorcontrol.php
http://michelf.com/weblog/2005/bad-uses-of-the-at-operator/
发布于 2012-03-23 16:23:53
@不能与没有$的变量一起使用。这是语法错误。
https://stackoverflow.com/questions/9835933
复制相似问题