封装了getpost方法的PHP代码
时间:2021-07-01 10:21:17
帮助过:4人阅读
[PHP]代码 - function g($name, $defaultValue = "") {
- // php这里区分大小写,将两者都变为小写
- $_GET = array_change_key_case ( $_GET, CASE_LOWER );
- $name = strtolower ( $name );
- $v = isset ( $_GET [$name] ) ? $_GET [$name] : "";
- if ($v == "")
- {
- $_POST = array_change_key_case ( $_POST, CASE_LOWER );
- $v = isset ( $_POST [$name] ) ?$_POST [$name] : "";
- }
- if ($v == "")
- return $defaultValue;
- else
- {
- // 20141011 jc : js_unescape($v)会引起 where ( col_subject like '%123%' ) 会变成 where ( col_subject like '%3%' )
- //$v = js_unescape($v) ;
- $v = trim($v);
- return $v;
- }
- }
- }
|
装了, post, PHP