⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 static.php

📁 zend的加强包 zend的加强包
💻 PHP
字号:
<?php/** * Zend Framework * * LICENSE * * This source file is subject to the new BSD license that is bundled * with this package in the file LICENSE.txt. * It is also available through the world-wide-web at this URL: * http://framework.zend.com/license/new-bsd * If you did not receive a copy of the license and are unable to * obtain it through the world-wide-web, please send an email * to license@zend.com so we can send you a copy immediately. * * @package    Zend_Controller * @subpackage Router * @copyright  Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com) * @version    $Id: Route.php 1847 2006-11-23 11:36:41Z martel $ * @license    http://framework.zend.com/license/new-bsd     New BSD License *//** Zend_Controller_Router_Route_Interface */require_once 'Zend/Controller/Router/Route/Interface.php';/** * StaticRoute is used for managing static URIs. * * It's a lot faster compared to the standard Route implementation. * * @package    Zend_Controller * @subpackage Router * @copyright  Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com) * @license    http://framework.zend.com/license/new-bsd     New BSD License */class Zend_Controller_Router_Route_Static implements Zend_Controller_Router_Route_Interface{    protected $_route = null;    protected $_defaults = array();    /**     * Instantiates route based on passed Zend_Config structure     *     * @param Zend_Config $config Configuration object     */    public static function getInstance(Zend_Config $config)    {        $defs = ($config->defaults instanceof Zend_Config) ? $config->defaults->toArray() : array();        return new self($config->route, $defs);    }    /**     * Prepares the route for mapping.     *     * @param string $route Map used to match with later submitted URL path     * @param array $defaults Defaults for map variables with keys as variable names     */    public function __construct($route, $defaults = array())    {        $this->_route = trim($route, '/');        $this->_defaults = (array) $defaults;    }    /**     * Matches a user submitted path with a previously defined route.     * Assigns and returns an array of defaults on a successful match.     *     * @param string $path Path used to match against this routing map     * @return array|false An array of assigned values or a false on a mismatch     */    public function match($path)    {        if (trim($path, '/') == $this->_route) {            return $this->_defaults;        }        return false;    }    /**     * Assembles a URL path defined by this route     *     * @param array $data An array of variable and value pairs used as parameters     * @return string Route path with user submitted parameters     */    public function assemble($data = array())    {        return $this->_route;    }    /**     * Return a single parameter of route's defaults     *     * @param string $name Array key of the parameter     * @return string Previously set default     */    public function getDefault($name) {        if (isset($this->_defaults[$name])) {            return $this->_defaults[$name];        }        return null;    }    /**     * Return an array of defaults     *     * @return array Route defaults     */    public function getDefaults() {        return $this->_defaults;    }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -