本文整理匯總了PHP中FileHelper::normalizePath方法的典型用法代碼示例。如果您正苦於以下問題:PHP FileHelper::normalizePath方法的具體用法?PHP FileHelper::normalizePath怎麽用?PHP FileHelper::normalizePath使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類FileHelper
的用法示例。
在下文中一共展示了FileHelper::normalizePath方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: applyTo
public function applyTo($path)
{
return parent::applyTo($path);
$pathMap = $this->pathMap;
if (empty($pathMap)) {
if (($basePath = $this->getBasePath()) === null) {
throw new InvalidConfigException('The "basePath" property must be set.');
}
$pathMap = [Yii::$app->getBasePath() => [$basePath]];
}
$path = FileHelper::normalizePath($path);
foreach ($pathMap as $from => $tos) {
$from = FileHelper::normalizePath(Yii::getAlias($from)) . DIRECTORY_SEPARATOR;
if (strpos($path, $from) === 0) {
$n = strlen($from);
foreach ((array) $tos as $to) {
$to = FileHelper::normalizePath(Yii::getAlias($to)) . DIRECTORY_SEPARATOR;
$file = $to . substr($path, $n);
if (is_file($file)) {
return $file;
}
}
}
}
return $path;
}
示例2: getMessageFilePath
/**
* Returns message file path for the specified language and category.
* @param string $category The message category.
* @param string $language The target language.
* @return string The path to message file.
*/
protected function getMessageFilePath($category, $language) : string
{
$path = preg_replace('/\\.php$/i', '.json', parent::getMessageFilePath($category, $language));
return FileHelper::normalizePath($path);
}