改名
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
|
||||
namespace Server\Protocol;
|
||||
|
||||
|
||||
abstract class Protocol
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* @param $data
|
||||
* @return array
|
||||
*/
|
||||
public function resolveProtocol($data): array
|
||||
{
|
||||
$explode = explode("\r\n\r\n", $data);
|
||||
|
||||
$http_protocol = [];
|
||||
foreach (explode("\r\n", $explode[0]) as $key => $datum) {
|
||||
if (empty($datum) || $key == 0) {
|
||||
continue;
|
||||
}
|
||||
[$key, $value] = explode(': ', $datum);
|
||||
|
||||
$http_protocol[trim($key)] = trim($value);
|
||||
}
|
||||
return [$http_protocol, $explode[1]];
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user