-
Notifications
You must be signed in to change notification settings - Fork 223
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
如何修改请求参数 #403
Comments
你这是实际业务中的问题、和框架没关系、具体实现你可以在Controller中处理具体讲逻辑 |
框架默认的查询是
|
重写项目根目录下 <?php
/**
* This file is part of webman.
*
* Licensed under The MIT License
* For full copyright and license information, please see the MIT-LICENSE.txt
* Redistributions of files must retain the above copyright notice.
*
* @author walkor<[email protected]>
* @copyright walkor<[email protected]>
* @link http://www.workerman.net/
* @license http://www.opensource.org/licenses/mit-license.php MIT License
*/
namespace support;
/**
* Class Request
* @package support
*/
class Request extends \Webman\Http\Request {
/**
* 获取过滤后的 post 数据
* @param $name
* @param $default
* @return mixed|null
*/
public function post($name = null, $default = null) {
// 获取请求的所有参数
$params = parent::post(); // 只获取 POST 请求的参数
...自定义处理逻辑
if ($name) {
return collect($params)->get($name, $default);
} else {
return $params;
}
}
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
请问如何修改请求参数,并可以对后续别的方法起到影响
举例:
数据查询时,如果没有传递排序字段,就按照主键倒序排。 尝试过在 layui.table.render 方法中传递 where,但是点击搜索的时候不会传递这个
有没有办法,在控制器或者哪里修改参数,并且对后续产生影响
The text was updated successfully, but these errors were encountered: