src/http/Request.php
private function multipartFromData ()
	{
		$body = explode('--' . $this->header['content-type-params']['boundary'], $this->raw_context);
		unset($body[0], $body[ count($body) ]);

		foreach ($body as $value) {
			$_     = explode("\r\n\r\n", $value);
			$_info = explode("\r\n", $_[0]);

			$_tmp = [];

			$_tmp_arr = explode(';', $_info[1]);

			foreach ($_tmp_arr as $k => $v) {
				if (0 === $k) {
					$__tmp                   = explode(':', $v);
					$_tmp[ trim($__tmp[0]) ] = trim($__tmp[1]);
				}
				else {
					$__tmp                   = explode('=', $v);
					$_tmp[ trim($__tmp[0]) ] = trim($__tmp[1], '"');
				}
			}
			if (isset($_tmp['filename'])) {
				$file_path     = Conf::createTempFile($this->session_id, 'haoge.tmpfile.' . uniqid(), $_[ count($_) - 1 ]);
				$this->files[] = [
					'size'  => filesize($file_path),
					'name'  => $_tmp['filename'],
					'tmp'   => $file_path,
					//					'tmp_name' => $file_path,
					'error' => !(bool)$file_path,
					'type'  => trim(explode(':', $_info[2])[1])
				];
			}
			else {
				$this->body[ $_tmp['name'] ] = trim($_[ count($_) - 1 ]);
			}

		}
	}
private function multipartFromData ()
	{
		$body = explode('--' . $this->header['content-type-params']['boundary'], $this->raw_context);
		unset($body[0], $body[ count($body) ]);

		foreach ($body as $value) {
			$_     = explode("\r\n\r\n", $value);
			$_info = explode("\r\n", $_[0]);

			$_tmp = [];

			$_tmp_arr = explode(';', $_info[1]);

			foreach ($_tmp_arr as $k => $v) {
				if (0 === $k) {
					$__tmp                   = explode(':', $v);
					$_tmp[ trim($__tmp[0]) ] = trim($__tmp[1]);
				}
				else {
					$__tmp                   = explode('=', $v);
					$_tmp[ trim($__tmp[0]) ] = trim($__tmp[1], '"');
				}
			}
			if (isset($_tmp['filename'])) {
				$file_path     = Conf::createTempFile($this->session_id, 'haoge.tmpfile.' . uniqid(), $_[ count($_) - 1 ]);
				$this->files[] = [
					'size'  => filesize($file_path),
					'name'  => $_tmp['filename'],
					'tmp'   => $file_path,
					//					'tmp_name' => $file_path,
					'error' => !(bool)$file_path,
					'type'  => trim(explode(':', $_info[2])[1])
				];
			}
			else {
				$this->body[ $_tmp['name'] ] = trim($_[ count($_) - 1 ]);
			}

		}
	}
文件上传 或者 form-data