本文整理汇总了PHP中Http::info方法的典型用法代码示例。如果您正苦于以下问题:PHP Http::info方法的具体用法?PHP Http::info怎么用?PHP Http::info使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Http
的用法示例。
在下文中一共展示了Http::info方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: sendRequest
public static function sendRequest($req)
{
$rsp = Http::send($req);
$info = Http::info();
$ret = json_decode($rsp, true);
if ($ret) {
if (0 === $ret['code']) {
$ret['httpcode'] = $info['http_code'];
return $ret;
} else {
return array('httpcode' => $info['http_code'], 'code' => $ret['code'], 'message' => $ret['message'], 'data' => array());
}
} else {
return array('httpcode' => $info['http_code'], 'code' => self::COSAPI_NETWORK_ERROR, 'message' => $rsp, 'data' => array());
}
}
示例2: del
public static function del($bucket, $fileid, $userid = 0)
{
if (!$fileid) {
return array('httpcode' => 0, 'code' => self::IMAGE_PARAMS_ERROR, 'message' => 'params error', 'data' => array());
}
$expired = 0;
$url = self::generateResUrl($bucket, $userid, $fileid, 'del');
$sign = Auth::getAppSignV2($bucket, $fileid, $expired);
$req = array('url' => $url, 'method' => 'post', 'timeout' => 10, 'header' => array('Authorization:QCloud ' . $sign));
$rsp = Http::send($req);
$info = Http::info();
$ret = json_decode($rsp, true);
if ($ret) {
if (0 === $ret['code']) {
return array('httpcode' => $info['http_code'], 'code' => $ret['code'], 'message' => $ret['message'], 'data' => array());
} else {
return array('httpcode' => $info['http_code'], 'code' => $ret['code'], 'message' => $ret['message'], 'data' => array());
}
} else {
return array('httpcode' => $info['http_code'], 'code' => self::IMAGE_NETWORK_ERROR, 'message' => 'network error', 'data' => array());
}
}
示例3: upload_data
/**
* 上传文件流
* @param integer $userid 用户自定义分类
* @param string $file_data 文件内容
* @param string $session 上传唯一标识符
* @param string $offset 开始传输的位移
* @return [type] [description]
*/
public static function upload_data($userid, $file_data, $session, $offset)
{
$expired = time() + self::EXPIRED_SECONDS;
$url = self::generateResUrl($userid);
$sign = Auth::appSign($url, $expired);
$data = array('FileContent' => $file_data, 'op' => 'upload_slice', 'session' => $session, 'offset' => $offset);
$req = array('url' => $url, 'method' => 'post', 'timeout' => 10, 'data' => $data, 'header' => array('Authorization:' . $sign));
$rsp = Http::send($req);
$info = Http::info();
$ret = json_decode($rsp, true);
if ($ret) {
if (0 === $ret['code']) {
$ret['httpcode'] = $info['http_code'];
return $ret;
} else {
return array('httpcode' => $info['http_code'], 'code' => $ret['code'], 'message' => $ret['message'], 'data' => array());
}
} else {
return array('httpcode' => $info['http_code'], 'code' => self::VIDEO_NETWORK_ERROR, 'message' => 'network error', 'data' => array());
}
}
示例4: getStatusText
/**
* return the status message
*/
public static function getStatusText()
{
$status = Http::info()['http_code'];
return self::statusText($status);
}