选择语言 :

 Core_File::call_http_host

调用HttpServer执行

boolean Core_File::call_http_host( string $storage , string $uri [, mixed $arg1 = null , mixed $arg2 = null ] )

参数列表

参数 类型 描述 默认值
$storage string $storage
$uri string $uri
$arg1 mixed $arg1 null
$arg2 mixed $arg2 null
返回值
  • boolean mixed
File: ./core/classes/file.class.php
protected static function call_http_host($storage, $uri, $arg1 = null, $arg2 = null)
{
    $param_arr = func_get_args();
    array_shift($param_arr); // 把 $storage 移除

    $sync_mode = File::sync_mode();

    if ( $sync_mode == 'rsync' )
    {
        // rsync 模式,调用主服执行
        $action = 'master_exec';
    }
    else
    {
        // 全部同步执行
        $action = 'sync_exec';
    }

    $rs = call_user_func_array(array(HttpCall::factory($storage), $action), $param_arr);

    if (IS_DEBUG)Core::debug()->log($rs);

    if (is_array($rs))
    {
        $i = 0;
        foreach ($rs as $item)
        {
            $i++;

            if ($item!=='success')
            {
                if (IS_DEBUG)
                {
                    Core::debug()->error($i.'/'.count($rs), 'call_http_host rs status');
                }
                return false;
            }
        }
    }
    else
    {
        if ($rs==='success')
        {
            return true;
        }
        else
        {
            Core::debug()->error('call_http_host error.');
            return false;
        }
    }

    return $rs;
}