Параметр Zend Retrieve Url - PullRequest
       22

Параметр Zend Retrieve Url

0 голосов
/ 10 мая 2011

Это мой первый подход к Zend. Имеет это индексное действие:

class IndexController extends Zend_Controller_Action
{
 public function indexAction()
 {
    $this->view->variable="I'm testing my controller";
    if($this->_request->isGet())
    {
        $name=$this->_request->getQuery('mykey');
        $this->view->name=$name;
    }   
 }
}

и это представление index.phtml:

echo $this->variable;
if (isset($this->name))
{echo $this->name;}

Если я наберу этот URL:

http://localhost/index/index/mykey/2

Разве я не вижу вывод "2" в моем представлении индекса ??Я просто вижу «я тестирую свой контроллер»;

Ps нужно объяснить больше, чем решение =)

спасибо

Luca

1 Ответ

2 голосов
/ 10 мая 2011

Использование

$this->_getParam ('mykey', 0);

вместо.

...