本文整理汇总了PHP中RequestUtil::buildUrl方法的典型用法代码示例。如果您正苦于以下问题:PHP RequestUtil::buildUrl方法的具体用法?PHP RequestUtil::buildUrl怎么用?PHP RequestUtil::buildUrl使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RequestUtil
的用法示例。
在下文中一共展示了RequestUtil::buildUrl方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _getAuthorizeUrl
protected function _getAuthorizeUrl($redirectUri, $state)
{
return RequestUtil::buildUrl($this->userLocale, $this->appInfo->getHost()->getWeb(), "1/oauth2/authorize", array("client_id" => $this->appInfo->getKey(), "response_type" => "code", "redirect_uri" => $redirectUri, "state" => $state));
}
示例2: getThumbnail
/**
* Gets a thumbnail image representation of the file at the given path.
*
* @param string $path
* The path to the file you want a thumbnail for (UTF-8).
*
* @param string $format
* One of the two image formats: "jpeg" or "png".
*
* @param string $size
* One of the predefined image size names, as a string:
* <ul>
* <li>"xs" - 32x32</li>
* <li>"s" - 64x64</li>
* <li>"m" - 128x128</li>
* <li>"l" - 640x480</li>
* <li>"xl" - 1024x768</li>
* </ul>
*
* @return array|null
* If the file exists, you'll get <code>list(array $metadata, string $data)</code> where
* <code>$metadata</code> is the file's
* <a href="https://www.dropbox.com/developers/core/api#metadata-details">metadata object</a>
* and $data is the raw data for the thumbnail image. If the file doesn't exist, you'll
* get <code>null</code>.
*
* @throws Exception
*/
function getThumbnail($path, $format, $size)
{
Path::checkArgNonRoot("path", $path);
Checker::argString("format", $format);
Checker::argString("size", $size);
if (!in_array($format, array("jpeg", "png"))) {
throw new \InvalidArgumentException("Invalid 'format': " . self::q($format));
}
if (!in_array($size, array("xs", "s", "m", "l", "xl"))) {
throw new \InvalidArgumentException("Invalid 'size': " . self::q($format));
}
$url = RequestUtil::buildUrl($this->userLocale, $this->contentHost, $this->appendFilePath("1/thumbnails", $path), array("size" => $size, "format" => $format));
$curl = $this->mkCurl($url);
$metadataCatcher = new DropboxMetadataHeaderCatcher($curl->handle);
$curl->set(CURLOPT_RETURNTRANSFER, true);
$response = $curl->exec();
if ($response->statusCode === 404) {
return null;
}
if ($response->statusCode !== 200) {
throw RequestUtil::unexpectedStatus($response);
}
$metadata = $metadataCatcher->getMetadata();
return array($metadata, $response->body);
}