src/Upyun/Upyun.php
public function has($path)
    {
        $req = new Rest($this->config);
        try {
            $req->request('HEAD', $path)
                            ->send();
        } catch (GuzzleHttp\Exception\BadResponseException $e) {
            $statusCode = $e->getResponse()->getStatusCode();
            if ($statusCode === 404) {
                return false;
            } else {
                throw $e;
            }
        }

        return true;
    }
public function has($path)
    {
        $req = new Rest($this->config);
        try {
            $req->request('HEAD', $path)
                            ->send();
        } catch (GuzzleHttp\Exception\BadResponseException $e) {
            $statusCode = $e->getResponse()->getStatusCode();
            if ($statusCode === 404) {
                return false;
            } else {
                throw $e;
            }
        }

        return true;
    }
public function has ( $ path ) { $ req = new Rest ( $ this -> config ) ; try { $ req -> request ( 'HEAD' , $ path ) -> send ( ) ; } catch ( GuzzleHttp \ Exception \ BadResponseException $ e ) { $ statusCode = $ e -> getResponse ( ) -> getStatusCode ( ) ; if ( $ statusCode === 404 ) { return false ; } else { throw $ e ; } } return true ; }
判断文件是否存在于又拍云存储

注意: 对刚删除的文件, 立即调用该方法可能会返回 true, 因为服务端执行删除操作后可能会有很短暂的延迟.

@param string $path 云存储的文件路径

@return bool 存在时返回 `true`，否则返回 `false`
@throws \Exception
判断文件是否存在于又拍云存储