封装了get和post方法,如何实现更高效的数据交互?

更新于
2026-09-26 05:54:13
1阅读来源:SEO资源
  • 内容介绍
  • 文章标签
  • 相关推荐

本文共计97个文字,预计阅读时间需要1分钟。

封装了get和post方法,如何实现更高效的数据交互?

phpfunction g($name, $defaultValue=) { $_GET=array_change_key_case($_GET, CASE_LOWER); $name=strtolower($name); $v=isset($_GET[$name]) ? $_GET[$name] : ; if ($v===) { return $defaultValue; } return $v;}

封装了get和post方法,如何实现更高效的数据交互?

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; } } }

本文共计97个文字,预计阅读时间需要1分钟。

封装了get和post方法,如何实现更高效的数据交互?

phpfunction g($name, $defaultValue=) { $_GET=array_change_key_case($_GET, CASE_LOWER); $name=strtolower($name); $v=isset($_GET[$name]) ? $_GET[$name] : ; if ($v===) { return $defaultValue; } return $v;}

封装了get和post方法,如何实现更高效的数据交互?

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; } } }