本文整理汇总了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, '/');
}