本文整理匯總了PHP中StringHelper::byteSubstr方法的典型用法代碼示例。如果您正苦於以下問題:PHP StringHelper::byteSubstr方法的具體用法?PHP StringHelper::byteSubstr怎麽用?PHP StringHelper::byteSubstr使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類StringHelper
的用法示例。
在下文中一共展示了StringHelper::byteSubstr方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: parseExcludePattern
private static function parseExcludePattern($pattern)
{
if (!is_string($pattern)) {
throw new \Exception('Exclude/include pattern must be a string.');
}
$result = ['pattern' => $pattern, 'flags' => 0, 'firstWildcard' => false];
if (!isset($pattern[0])) {
return $result;
}
if ($pattern[0] == '!') {
$result['flags'] |= self::PATTERN_NEGATIVE;
$pattern = StringHelper::byteSubstr($pattern, 1, StringHelper::byteLength($pattern));
}
$len = StringHelper::byteLength($pattern);
if ($len && StringHelper::byteSubstr($pattern, -1, 1) == '/') {
$pattern = StringHelper::byteSubstr($pattern, 0, -1);
$len--;
$result['flags'] |= self::PATTERN_MUSTBEDIR;
}
if (strpos($pattern, '/') === false) {
$result['flags'] |= self::PATTERN_NODIR;
}
$result['firstWildcard'] = self::firstWildcardInPattern($pattern);
if ($pattern[0] == '*' && self::firstWildcardInPattern(StringHelper::byteSubstr($pattern, 1, StringHelper::byteLength($pattern))) === false) {
$result['flags'] |= self::PATTERN_ENDSWITH;
}
$result['pattern'] = $pattern;
return $result;
}