如果你对该文章中的内容有疑问/不解,可以点击此处链接提问
要注明问题和此文章链接地址 点击此处跳转
if (isset($GLOBALS['HTTP_RAW_POST_DATA'])) { $userinfo1 = $GLOBALS['HTTP_RAW_POST_DATA']; } else { $userinfo1 = file_get_contents('php://input'); } $userinfo = object_to_array(json_decode($userinfo1));//z转化为数组 /** * 对象 转 数组 * * @param object $obj 对象 * @return array */ function object_to_array($obj) { $obj = (array)$obj; foreach ($obj as $k => $v) { if (gettype($v) == 'resource') { return; } if (gettype($v) == 'object' || gettype($v) == 'array') { $obj[$k] = (array)object_to_array($v); } } return $obj; }