在ZF中,只能在Controller中取得Post跟Get的值!
取得的方式是用$this->_request->get()及$this->_request->getPost()兩個方法
FooController
<?php
class FooController extends Zend_Controller_Action {
public function indexAction() {
$get = $this->_request->get("act");
$post = $this->_request->getPost("name");
//or
$test = $this->_request->getParam("test");
$this->view->msg = "GET:" . $get . " POST:" . $post;
//取得POST陣列
$post = $this->_request->getPost();
//取得GET陣列(含controller、action、module)
$get = $this->_request->getParams();
//也可以使用Controller中取得參數的方法
$request = $this->getRequest();
if ($request->isPost()) {
$param = $request->getParams();
}
}
}
?>