當我執行/ mycontroller /搜索它只顯示「/ mycontroller」,但 當我在search
方法時如何獲得「/ mycontroller/search」,當我處於other
時,如何獲得「/ mycontroller/other」方法。ZendFramework - 如何知道哪個控制器和哪個特定的方法被執行?
class Mycontroller extends Zend_Controller_Action
{
private $url = null;
public function otherAction() {
$this->url .= "/" . $this->getRequest()->getControllerName();
echo $this->url; // output: /mycontroller
exit;
}
public function searchAction() {
$this->url .= "/" . $this->getRequest()->getControllerName();
echo $this->url; // output: /mycontroller
// expect: /mycontroller/search
exit;
}
}