(Yaf >=3.2.2)
Yaf_Request_Abstract::getQuery — Fetch a query parameter
Retrieves a variable from $_GET.
nameThe variable name. If omitted, the whole array is returned.
defaultThe value to return if the variable is not found.
The query parameter value, or default if it is not set.
Exemplo #1 Yaf_Request_Abstract::getQuery() example
<?php
class SearchController extends Yaf_Controller_Abstract
{
public function indexAction()
{
// Assuming the request is /search?keyword=yaf&page=2
$keyword = $this->getRequest()->getQuery("keyword");
$page = (int) $this->getRequest()->getQuery("page", 1);
var_dump($keyword, $page);
}
}
?>O exemplo acima produzirá algo semelhante a:
string(3) "yaf" int(2)