本文整理匯總了PHP中sfRoute::getVariables方法的典型用法代碼示例。如果您正苦於以下問題:PHP sfRoute::getVariables方法的具體用法?PHP sfRoute::getVariables怎麽用?PHP sfRoute::getVariables使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類sfRoute
的用法示例。
在下文中一共展示了sfRoute::getVariables方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: createHostRoute
/**
* Returns a new route object for inspecting and generating the host.
*
* @param string $pattern The host pattern
* @param array $defaults All defaults for the current route
* @param array $requirements All requirements for the current route
* @param array $options All options for the current route
*
* @return sfRoute
*/
protected function createHostRoute($pattern, $defaults, $requirements, $options)
{
$filteredDefaults = array();
$filteredRequirements = array();
// this temporary route is just for extracting variables from the pattern
$tmp = new sfRoute($pattern);
foreach (array_keys($tmp->getVariables()) as $name) {
if (isset($defaults[$name])) {
$filteredDefaults[$name] = $defaults[$name];
}
if (isset($requirements[$name])) {
$filteredRequirements[$name] = $requirements[$name];
}
}
return new sfRoute($pattern, $filteredDefaults, $filteredRequirements, $options);
}