开发者

PHP ftp_chdir - can't mask error

I have function below to check if specific item is directory or file:

private function isDir($dir)
{
    if ( @ftp_chdir($this->connected, $dir) === true )
    {
        ftp_chdir($this->connected, '..');
        return true;
    }
    else
    {
        return false;
    }
}

It detects correctly but even if I put @ before error I always get the same error:

WARNING: [2] - ftp_chdir() [function.ftp-chd开发者_JS百科ir]: CWD failed. "/someDIR/someFile.xls": directory not found.  in file: D:\www\testiranje\epg\classes\ftpClass.php - line 147

I know that error is more than expected, but that is the best way I figured out to detect if some item is dir or not ...

Thanks for your help!


use is_dir like :

is_dir('ftp://user:password@example.com/some/dir/path');


I think it can be suppresed, using this in your code - prior to the statement, that issuses the the Warning

error_reporting(E_ERROR);  
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜