作者 邓超

body 解析

@@ -37,6 +37,20 @@ class DataArray { @@ -37,6 +37,20 @@ class DataArray {
37 } 37 }
38 } 38 }
39 39
  40 + /**
  41 + * 检查了 没有才设置值
  42 + * @param string $name
  43 + * @param mixed $val
  44 + * @param bool $append
  45 + * @author:dc
  46 + * @time 2025/4/17 11:15
  47 + */
  48 + public function set_check(string $name, mixed $val, bool $append = false){
  49 + if(!$this->get($name)){
  50 + $this->set( $name, $val, $append = false);
  51 + }
  52 + }
  53 +
40 54
41 /** 55 /**
42 * @param string $name 56 * @param string $name
@@ -246,7 +246,7 @@ class Body { @@ -246,7 +246,7 @@ class Body {
246 if (str_contains($ct,'=')){ 246 if (str_contains($ct,'=')){
247 // 这里包含了其他 247 // 这里包含了其他
248 list($name,$val) = explode('=',$ct,2); 248 list($name,$val) = explode('=',$ct,2);
249 - $data->set($name,DeCode::decode(str_replace('"','',$val))); 249 + $data->set_check($name,DeCode::decode(str_replace('"','',$val)));
250 }elseif($ct){ 250 }elseif($ct){
251 $data->set($key,$ct); 251 $data->set($key,$ct);
252 } 252 }