本文整理汇总了PHP中jUrl::setParam方法的典型用法代码示例。如果您正苦于以下问题:PHP jUrl::setParam方法的具体用法?PHP jUrl::setParam怎么用?PHP jUrl::setParam使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类jUrl
的用法示例。
在下文中一共展示了jUrl::setParam方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: buildWithSpecificPathinfo
/**
* @param array $urlinfo
* array(1,'entrypoint', https true/false,
* array('year','month',), // list of dynamic values included in the url
* array(true, false..), // list of integers which indicates for each
* // dynamic value: 0: urlencode, 1:urlencode except '/', 2:escape
* "/news/%1/%2/", // the url
* true/false, // false : this is a secondary action
* array('bla'=>'whatIWant' ) // list of static values
* )
*/
protected function buildWithSpecificPathinfo(\jUrlAction $urlact, \jUrl $url, $urlinfo)
{
$pi = $urlinfo[5];
foreach ($urlinfo[3] as $k => $param) {
$escape = $urlinfo[4][$k];
$value = $url->getParam($param, '');
if ($escape & self::ESCAPE_NON_ASCII) {
$value = \jUrl::escape($value, true);
} elseif ($escape & self::ESCAPE_SLASH) {
$value = str_replace('%2F', '/', urlencode($value));
} elseif ($escape & self::ESCAPE_LANG) {
if ($value == '') {
$value = Locale::getCurrentLang();
} elseif (preg_match('/^(\\w{2,3})_\\w{2,3}$/', $value, $m)) {
$value = $m[1];
}
} elseif ($escape & self::ESCAPE_LOCALE) {
if ($value == '') {
$value = App::config()->locale;
} elseif (preg_match('/^\\w{2,3}$/', $value, $m)) {
$value = Locale::langToLocale($value);
}
} else {
$value = urlencode($value);
}
$pi = str_replace(':' . $param, $value, $pi);
$url->delParam($param);
}
$url->pathInfo = $pi != '/' ? $pi : '';
if ($urlinfo[6]) {
$url->setParam('action', $urlact->getParam('action'));
}
// removed parameters corresponding to static values
foreach ($urlinfo[7] as $name => $value) {
$url->delParam($name);
}
}