[英]issue about url method in zend framework1
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框架中,路由是什么? 下面的代碼來自:index.phtml
<a href="<?php echo $this->url(array('controller'=>'index',
'action'=>'edit', 'id'=>$album->id));?>">Edit</a>
那么您能在這里解釋url()方法如何起作用嗎?
Zend具有這樣的url結構:
主機名/控制器/操作/參數
對於本地主機
本地主機/索引/索引/用戶名/ pramod
哪里
Host- localhost
Controller - indexController
Action - index action in the indexcontroller
Parameter - username
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.