I am currently running a script that is failing to work, it turns out that there is this line:
$this->conn_id = @ftp_connect($this->ftp_server);
This line throw ftp_connect
function undefined, but as it's preceded by @
operator, shouldn't it not terminated?
Anyway I checked there is error_reporting(E_ALL);
in the beginning of the script. Is this the cause?
Thanks!
答案 0 :(得分:3)
Like in php doc http://php.net/manual/en/function.error-reporting.php
The @-operator works only on expressions. A simple rule of thumb is: if you can take the value of something, you can prepend the @ operator to it. For instance, you can prepend it to variables, function and include calls, constants, and so forth. You cannot prepend it to function or class definitions, or conditional structures such as if and foreach, and so forth.
this mean that if the error is not related to the pure expression ..(like a fatal error) the error i raised ..
答案 1 :(得分:1)
As previous answers has specified @ doesnt work to suppress error when a function doesnt exits, however
if (function_exists('ftp_connect')){
$this->conn_id = ftp_connect($this->ftp_server);
}
will do the trick