This commit is contained in:
xl
2023-11-11 11:34:34 +08:00
parent 8f730e13ba
commit b323efbf19
+15
View File
@@ -664,6 +664,21 @@ class Request implements ServerRequestInterface
}
/**
* @param string $name
* @param int $default
* @return int
*/
public function queryInt(string $name, int $default = 0): int
{
$data = $this->getQueryParams();
if (!isset($data[$name])) {
return (int)$data[$name];
}
return $default;
}
/**
* Return an instance with the specified body parameters.
*