Request.php 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. <?php
  2. /**
  3. * This file is part of webman.
  4. *
  5. * Licensed under The MIT License
  6. * For full copyright and license information, please see the MIT-LICENSE.txt
  7. * Redistributions of files must retain the above copyright notice.
  8. *
  9. * @author walkor<walkor@workerman.net>
  10. * @copyright walkor<walkor@workerman.net>
  11. * @link http://www.workerman.net/
  12. * @license http://www.opensource.org/licenses/mit-license.php MIT License
  13. */
  14. namespace support;
  15. /**
  16. * Class Request
  17. * @package support
  18. */
  19. class Request extends \Webman\Http\Request
  20. {
  21. /**
  22. * 获取参数增强方法
  23. * @param array $params
  24. * @return array
  25. */
  26. public function more(array $params): array
  27. {
  28. $p = [];
  29. foreach ($params as $param) {
  30. if (!is_array($param)) {
  31. $p[$param] = $this->input($param);
  32. } else {
  33. if (!isset($param[1])) $param[1] = '';
  34. if (is_array($param[0])) {
  35. $name = $param[0][0] . '/' . $param[0][1];
  36. $keyName = $param[0][0];
  37. } else {
  38. $name = $param[0];
  39. $keyName = $param[0];
  40. }
  41. $p[$keyName] = $this->input($name, $param[1]);
  42. }
  43. }
  44. return $p;
  45. }
  46. }