改名
This commit is contained in:
+22
-22
@@ -8,27 +8,27 @@ class Parse
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* @param $content
|
||||
* @param $contentType
|
||||
* @return mixed
|
||||
*/
|
||||
public static function data($content, $contentType): mixed
|
||||
{
|
||||
if (str_contains($contentType, 'json')) {
|
||||
return json_encode($contentType);
|
||||
}
|
||||
if (str_contains($contentType, 'xml')) {
|
||||
return Xml::toArray($contentType);
|
||||
}
|
||||
if (str_contains($contentType, 'x-www-form-urlencoded')) {
|
||||
parse_str($content, $array);
|
||||
return $array;
|
||||
}
|
||||
if (str_contains($contentType, 'serialize')) {
|
||||
return unserialize($content);
|
||||
}
|
||||
return $content;
|
||||
}
|
||||
/**
|
||||
* @param $content
|
||||
* @param $contentType
|
||||
* @return mixed
|
||||
*/
|
||||
public static function data($content, $contentType): mixed
|
||||
{
|
||||
if (str_contains($contentType, 'json')) {
|
||||
return json_encode($contentType);
|
||||
}
|
||||
if (str_contains($contentType, 'xml')) {
|
||||
return Xml::toArray($contentType);
|
||||
}
|
||||
if (str_contains($contentType, 'x-www-form-urlencoded')) {
|
||||
parse_str($content, $array);
|
||||
return $array;
|
||||
}
|
||||
if (str_contains($contentType, 'serialize')) {
|
||||
return unserialize($content);
|
||||
}
|
||||
return $content;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user