本文整理匯總了PHP中Bitrix\Main\IO\Path::convertLogicalToUri方法的典型用法代碼示例。如果您正苦於以下問題:PHP Path::convertLogicalToUri方法的具體用法?PHP Path::convertLogicalToUri怎麽用?PHP Path::convertLogicalToUri使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Bitrix\Main\IO\Path
的用法示例。
在下文中一共展示了Path::convertLogicalToUri方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: getSrcWithResize
public static function getSrcWithResize($file = array(), $size = array())
{
$file1 = \CFile::ResizeImageGet($file["ID"], $size, BX_RESIZE_IMAGE_PROPORTIONAL, false);
$src = $file1['src'];
if ($file['HANDLER_ID'] > 0) {
$src = "/" . \COption::GetOptionString("main", "upload_dir", "upload") . "/" . $file["SUBDIR"] . "/" . $file["FILE_NAME"];
$path = $_SERVER["DOCUMENT_ROOT"] . $src;
if (!(is_file($path) && file_exists($path))) {
$sign = new Signer();
$s = $sign->sign($file["ID"] . "x" . $size["width"] . "x" . $size["height"], self::$salt);
$src = \COption::GetOptionString("main.fileinput", "entryPointUrl", "/bitrix/tools/upload.php") . "?" . http_build_query(array("action" => "uncloud", "mode" => "resize", "file" => $file["ID"], "width" => $size["width"], "height" => $size["height"], "signature" => $s));
}
} else {
$src = \Bitrix\Main\IO\Path::convertLogicalToUri($src);
}
return $src;
}
示例2: getFileUrl
/**
* Returns file relative path for URL.
*
* @param File $f File object.
*
* @return string
*/
protected function getFileUrl(File $f)
{
static $indexNames;
if(!is_array($indexNames))
{
$indexNames = GetDirIndexArray();
}
$path = '/';
if (substr($this->path, 0, strlen($this->documentRoot)) === $this->documentRoot)
{
$path = '/'.substr($f->getPath(), strlen($this->documentRoot));
}
$path = Path::convertLogicalToUri($path);
$path = in_array($f->getName(), $indexNames)
? str_replace('/'.$f->getName(), '/', $path)
: $path;
return '/'.ltrim($path, '/');
}