mirror of
https://gitee.com/zongzhige/shopxo.git
synced 2026-07-06 13:43:02 +08:00
动态表格支持自定义字段和顺序
This commit is contained in:
@ -23,35 +23,28 @@
|
||||
*/
|
||||
function MyInput($key = null, $default = null)
|
||||
{
|
||||
static $data = null;
|
||||
if($data === null)
|
||||
static $params = null;
|
||||
if($params === null)
|
||||
{
|
||||
// raw
|
||||
$raw_data = empty($HTTP_RAW_POST_DATA) ? [] : (!is_array($HTTP_RAW_POST_DATA) ? json_decode($HTTP_RAW_POST_DATA, true) : []);
|
||||
|
||||
// request
|
||||
$request_data = empty($_REQUEST) ? [] : $_REQUEST;
|
||||
|
||||
// input
|
||||
$input_data = file_get_contents("php://input");
|
||||
$input_data = empty($input_data) ? [] : (!is_array($input_data) ? json_decode($input_data, true) : []);
|
||||
|
||||
// 数据合并
|
||||
$data = array_merge($raw_data, $request_data, $input_data);
|
||||
$params = input();
|
||||
if(empty($params))
|
||||
{
|
||||
$params = file_get_contents("php://input");
|
||||
}
|
||||
}
|
||||
|
||||
// 是否指定key
|
||||
if(!empty($key))
|
||||
if(!empty($key) && is_array($params))
|
||||
{
|
||||
if(array_key_exists($key, $data))
|
||||
if(array_key_exists($key, $params))
|
||||
{
|
||||
return is_array($data[$key]) ? $data[$key] : htmlspecialchars(trim($data[$key]));
|
||||
return is_array($params[$key]) ? $params[$key] : htmlspecialchars(trim($params[$key]));
|
||||
}
|
||||
return $default;
|
||||
}
|
||||
|
||||
// 未指定key则返回所有数据
|
||||
return $data;
|
||||
return $params;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user