当前位置:网站首页>自定义获取请求参数类 GET POST
自定义获取请求参数类 GET POST
2022-07-21 05:07:00 【MountainYanYL】
<?php class clsParams { public array $IaParams = []; public function __construct() { $this->l_getParams(); } public function recursary($array,$p=''){ foreach($array as $k=>$v){ $LsRetval[strtoupper(trim($k))] = $p == 'p' ? (is_array($v) ? $this->recursary($v,'p') : stripslashes($v)):(is_array($v) ? $this->recursary($v) : stripslashes($v)); } return $LsRetval; } public function getParam($PsName, $PsDefault = "",$dataType_change='') { if (isset($this->IaParams[strtoupper($PsName)])) { $LsRetval = is_array($this->IaParams[strtoupper($PsName)]) ? $this->recursary($this->IaParams[strtoupper($PsName)]) :trim($this->IaParams[strtoupper($PsName)]); if ($LsRetval== null) { $LsRetval = $PsDefault; } } else { $LsRetval = $PsDefault; } return $LsRetval; } public function l_getParams() { if ($_SERVER["REQUEST_METHOD"] == "GET" && isset($_GET)) { foreach ($_GET as $key => $val) { $this->IaParams[strtoupper(trim($key))] = is_string($val) ? stripslashes($val) : $val; } } if ($_SERVER['REQUEST_METHOD']== "POST" && isset($_POST)) { foreach ($_POST as $key => $val) { $this->IaParams[strtoupper(trim($key))] = is_array($val) ? $this->recursary($val,'p') : stripslashes($val); } } } } GLOBAL $GoParams; $GoParams = new clsParams(); ?>
边栏推荐
- 使用nodemon工具使Nodejs服务器自动重启
- Latex: derivative related symbols
- Click the back button to return to the previous page
- Simple method of array de duplication (excluding reference type)
- Custom MVC principle
- Handwriting promise
- 移动端 pc端 小程序 UI框架选择
- 蛇形数字宫格的实现. 编写一个cube函数,入参为num, 通过js实现 要求如下:当num=3时,输出表格效果为:[[1,2,3][6,5,4][7,8,9]]
- 微信小程序制作一个老虎机抽奖动画
- Oh my Zsh efficiency plug-in
猜你喜欢
随机推荐
[HTTP cache]
Latex: derivative related symbols
Object.prototype.toString.call()的原理
推薦一個好用的 所見即所得的 markdown 編輯器 Mark Text
专栏开设的意义
[C language] 100 Ultraman wars 100 monsters source code
微信小程序制作一个老虎机抽奖动画
nodemon +NodeJs + express 文件修改自动重启服务器
Output statements on the console
OpenFOAM编程:VOF法与多孔介质模型相结合
Simple method of array de duplication (excluding reference type)
uni-app 新建报错 Cannot read property mode of undefined
Format time
Custom MVC principle
二维无粘流动雅可比特征系统的推导
10. [file opening format and its determination of whether to open]
Uniapp customized navigation bar buttons and button click events
js运行机制
qml 实现csdn搜索框,无规则圆角
js页面的跳转以及接收参数