本文整理匯總了PHP中Bitrix\Main\IO\Path::convertPhysicalToUri方法的典型用法代碼示例。如果您正苦於以下問題:PHP Path::convertPhysicalToUri方法的具體用法?PHP Path::convertPhysicalToUri怎麽用?PHP Path::convertPhysicalToUri使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Bitrix\Main\IO\Path
的用法示例。
在下文中一共展示了Path::convertPhysicalToUri方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: handleFileByPath
protected static function handleFileByPath($hash, &$file)
{
$key = "default";
if (self::resizePicture($file["files"][$key], array("method" => "resample"))) {
clearstatcache();
$file["files"][$key]["wasChangedOnServer"] = true;
$file["files"][$key]["size"] = filesize($file["files"][$key]["tmp_name"]);
$file["files"][$key]["sizeFormatted"] = \CFile::FormatSize($file["files"][$key]["size"]);
}
$docRoot = \CBXVirtualIo::GetInstance()->CombinePath($_SERVER["DOCUMENT_ROOT"]);
$file["path"] = \CBXVirtualIo::GetInstance()->GetFile($file["files"][$key]["tmp_name"])->GetPathWithName();
if (strpos($file["path"], $docRoot) === 0) {
$file["path"] = str_replace("//", "/", "/" . substr($file["path"], strlen($docRoot)));
}
$file["files"][$key]["url"] = $file["files"][$key]["tmp_url"] = \Bitrix\Main\IO\Path::convertPhysicalToUri($file["path"]);
$file["type"] = $file["files"][$key]["type"];
return true;
}
示例2: handleFileByPath
protected static function handleFileByPath($hash, &$file)
{
$key = "default";
$path = $file["files"][$key]["tmp_name"];
$io = \CBXVirtualIo::GetInstance();
$newPath = substr($path, 0, (strlen($path) - strlen($key))).$file["name"];
$f = $io->GetFile($path);
$newF = $io->GetFile($newPath);
if ((!$newF->IsExists() || $newF->unlink()) && $io->Rename($path, $newPath))
{
$f = $io->GetFile($newPath);
$file["files"][$key]["tmp_name"] = $newPath;
}
if (self::resizePicture($file["files"][$key], array("method" => "resample")))
{
clearstatcache();
$file["files"][$key]["wasChangedOnServer"] = true;
$file["files"][$key]["size"] = filesize($file["files"][$key]["tmp_name"]);
$file["files"][$key]["sizeFormatted"] = \CFile::FormatSize($file["files"][$key]["size"]);
}
$file["path"] = \Bitrix\Main\IO\Path::convertPhysicalToLogical($f->GetPathWithName());
if (strpos($file["path"], $_SERVER["DOCUMENT_ROOT"]) === 0)
$file["path"] = str_replace("//", "/", "/".substr($file["path"], strlen($_SERVER["DOCUMENT_ROOT"])));
$file["uploadId"] = $file["path"];
$file["files"][$key]["url"] =
$file["files"][$key]["tmp_url"] = \Bitrix\Main\IO\Path::convertPhysicalToUri($file["path"]);
$file["type"] = $file["files"][$key]["type"];
return true;
}