当前位置: 首页>>代码示例>>PHP>>正文


PHP sfRouting::initialize方法代码示例

本文整理汇总了PHP中sfRouting::initialize方法的典型用法代码示例。如果您正苦于以下问题:PHP sfRouting::initialize方法的具体用法?PHP sfRouting::initialize怎么用?PHP sfRouting::initialize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在sfRouting的用法示例。


在下文中一共展示了sfRouting::initialize方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: initialize

 /**
  * Initializes this Routing.
  *
  * Available options:
  *
  *  * suffix:                           The default suffix
  *  * variable_prefixes:                An array of characters that starts a variable name (: by default)
  *  * segment_separators:               An array of allowed characters for segment separators (/ and . by default)
  *  * variable_regex:                   A regex that match a valid variable name ([\w\d_]+ by default)
  *  * generate_shortest_url:            Whether to generate the shortest URL possible (true by default)
  *  * extra_parameters_as_query_string: Whether to generate extra parameters as a query string
  *  * lookup_cache_dedicated_keys:      Whether to use dedicated keys for parse/generate cache (false by default)
  *                                      WARNING: When this option is activated, do not use sfFileCache; use a fast access
  *                                      cache backend (like sfAPCCache).
  *
  * @see sfRouting
  */
 public function initialize(sfEventDispatcher $dispatcher, sfCache $cache = null, $options = array())
 {
     $options = array_merge(array('variable_prefixes' => array(':'), 'segment_separators' => array('/', '.'), 'variable_regex' => '[\\w\\d_]+', 'load_configuration' => false, 'suffix' => '', 'generate_shortest_url' => true, 'extra_parameters_as_query_string' => true, 'lookup_cache_dedicated_keys' => false), $options);
     // for BC
     if ('.' == $options['suffix']) {
         $options['suffix'] = '';
     }
     parent::initialize($dispatcher, $cache, $options);
     if (null !== $this->cache && !$options['lookup_cache_dedicated_keys'] && ($cacheData = $this->cache->get('symfony.routing.data'))) {
         $this->cacheData = unserialize($cacheData);
     }
 }
开发者ID:sensorsix,项目名称:app,代码行数:29,代码来源:sfPatternRouting.class.php

示例2: initialize

 /**
  * Initializes this Routing.
  *
  * Available options:
  *
  *  * suffix:             The default suffix
  *  * variable_prefixes:  An array of characters that starts a variable name (: by default)
  *  * segment_separators: An array of allowed characters for segment separators (/ and . by default)
  *  * variable_regex:     A regex that match a valid variable name ([\w\d_]+ by default)
  *
  * @see sfRouting
  */
 public function initialize(sfEventDispatcher $dispatcher, sfCache $cache = null, $options = array())
 {
     if (!isset($options['variable_prefixes'])) {
         $options['variable_prefixes'] = array(':');
     }
     if (!isset($options['segment_separators'])) {
         $options['segment_separators'] = array('/', '.');
     }
     if (!isset($options['variable_regex'])) {
         $options['variable_regex'] = '[\\w\\d_]+';
     }
     $options['variable_prefix_regex'] = '(?:' . implode('|', array_map(create_function('$a', 'return preg_quote($a, \'#\');'), $options['variable_prefixes'])) . ')';
     $options['segment_separators_regex'] = '(?:' . implode('|', array_map(create_function('$a', 'return preg_quote($a, \'#\');'), $options['segment_separators'])) . ')';
     $options['variable_content_regex'] = '[^' . implode('', array_map(create_function('$a', 'return str_replace(\'-\', \'\\-\', preg_quote($a, \'#\'));'), $options['segment_separators'])) . ']+';
     if (!isset($options['load_configuration'])) {
         $options['load_configuration'] = false;
     }
     $this->setDefaultSuffix(isset($options['suffix']) ? $options['suffix'] : '');
     parent::initialize($dispatcher, $cache, $options);
     if (!is_null($this->cache) && ($cacheData = $this->cache->get('symfony.routing.data'))) {
         $this->cacheData = unserialize($cacheData);
     }
 }
开发者ID:ajith24,项目名称:ajithworld,代码行数:35,代码来源:sfPatternRouting.class.php


注:本文中的sfRouting::initialize方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。