本文整理汇总了PHP中Tool::explode方法的典型用法代码示例。如果您正苦于以下问题:PHP Tool::explode方法的具体用法?PHP Tool::explode怎么用?PHP Tool::explode使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Tool
的用法示例。
在下文中一共展示了Tool::explode方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: rules
/**
You can have this function include php field special syntax along with standard parsing.
@param string string that matches form of a url query string
@param specialSyntax whether to parse the string using php rules (where [] marks an array) in addition to "standard" rules
*/
static function parseQuery($string, $specialSyntax = false)
{
$parts = Tool::explode('&', $string);
$array = array();
foreach ($parts as $part) {
list($key, $value) = explode('=', $part);
$key = urldecode($key);
$value = urldecode($value);
if ($specialSyntax && ($matches = self::getSpecialSyntaxKeys($key))) {
if (Arrays::isElement($matches, $array)) {
$currentValue = Arrays::getElement($matches, $array);
if (is_array($currentValue)) {
$currentValue[] = $value;
} else {
$currentValue = array($currentValue, $value);
}
Arrays::updateElement($matches, $array, $currentValue);
} else {
Arrays::updateElement($matches, $array, $value);
}
unset($match, $matches);
} else {
if ($array[$key]) {
if (is_array($array[$key])) {
$array[$key][] = $value;
} else {
$array[$key] = array($array[$key], $value);
}
} else {
$array[$key] = $value;
}
}
}
return $array;
}
示例2: tokenise
private static function tokenise($urlDir)
{
self::$urlTokens = \Tool::explode('/', $urlDir);
self::$urlBase = $urlDir;
self::$urlCaselessBase = strtolower($urlDir);
}