选择语言 :

 Module_Storage_Driver_Swift::fp

连接服务器

resource Module_Storage_Driver_Swift::fp( string $protocol , int $host , int $port , $timeout )
throws
Exception

参数列表

参数 类型 描述 默认值
$protocol string $host
$host int $port
$port int $timeout
$timeout unknown
返回值
  • resource fsockopen returns a file pointer which may be used
File: ./modules/storage/driver/swift.class.php
protected function fp($protocol, $host, $port , $timeout)
{
    try
    {
        if ($protocol == 'https')
        {
            $fp = fsockopen('tls://' . $host, $port, $errno, $errstr, $timeout);
        }
        else
        {
            $fp = fsockopen($host, $port, $errno, $errstr, $timeout);
        }
    }
    catch (Exception $e)
    {
        $errstr = $e->getMessage();
        $errno  = $e->getCode();
        $fp     = false;
    }

    if (!$fp)
    {
        throw new Exception('Unable to connect to: ' . $host . ':' . $port ."\nError: " . $errstr . ' : ' .$errno);
    }

    return $fp;
}