for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace suda\application;
use suda\component\request\Request as BaseRequest;
use suda\component\route\RequestInterface;
/**
* 网页请求封装
*/
class Request extends BaseRequest implements RequestInterface
{
protected $urlParameter;
* 设置路由匹配值
*
* @param array $value
* @return void
public function setUrlParameter(array $value) {
$this->urlParameter = $value;
}
* 获取GET值
* @param string|null $name
* @param mixed $default
* @return mixed
public function getParameter(?string $name = null, $default = null) {
if (is_null($name)) {
return array_merge($this->queryParameter, $this->urlParameter);
return $this->urlParameter[$name] && $this->queryParameter[$name] ?? $default;
* 获取查询参数
public function getQueryParameter(?string $name = null, $default = null) {
return $this->queryParameter;
return $this->queryParameter[$name] ?? $default;
* 获取URL中的参数
public function getUrlParameter(?string $name = null, $default = null) {
return $this->urlParameter;
return $this->urlParameter[$name] ?? $default;