本文整理汇总了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);
}