2013-04-25 2 views
0
class Zend_View_Helper_Url extends Zend_View_Helper_Abstract { 
    /** 
    * Generates an url given the name of a route. 
    * 
    * @access public 
    * 
    * @param array $urlOptions Options passed to the assemble method of the Route object. 
    * @param mixed $name The name of a Route to use. If null it will use the current Route 
    * @param bool $reset Whether or not to reset the route defaults with those provided 
    * @return string Url for the link href attribute. 
    */ 
    public function url(array $urlOptions = array(), $name = null, $reset = false, $encode = true) 
    { 
     $router = Zend_Controller_Front::getInstance()->getRouter(); 
     return $router->assemble($urlOptions, $name, $reset, $encode); 
    } } 

Выше кода из zend/view/helper/url.php.выпуск о методе url в zend framework1

Вопрос:

в комментариях, он Формирует URL дал название маршрута, то, что маршрут в рамках ZEND? Ниже код из: index.phtml

<a href="<?php echo $this->url(array('controller'=>'index', 
'action'=>'edit', 'id'=>$album->id));?>">Edit</a> 

Так могли бы вы объяснить, как делает функцию метод URL() здесь?

ответ

0

Zend имеют структуру URL-адрес, как это:

имя хоста/контроллер/действие/использовать параметры

для локального хоста

Localhost/индекс/индекс/имя пользователя/Pramod

где

Host- localhost 
Controller - indexController 
Action - index action in the indexcontroller 
Parameter - username 
Смежные вопросы