改名
This commit is contained in:
@@ -16,6 +16,7 @@ use HttpServer\Http\Formatter\JsonFormatter;
|
||||
use HttpServer\Http\Formatter\XmlFormatter;
|
||||
use JetBrains\PhpStorm\Pure;
|
||||
use Snowflake\Core\Help;
|
||||
use Snowflake\Core\Json;
|
||||
use Snowflake\Snowflake;
|
||||
use Swoole\Http\Response as SResponse;
|
||||
use Swoole\Http2\Response as S2Response;
|
||||
@@ -217,6 +218,7 @@ class Response extends HttpService
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $response
|
||||
* @param $sendData
|
||||
* @param $status
|
||||
* @throws Exception
|
||||
@@ -226,11 +228,19 @@ class Response extends HttpService
|
||||
if (!swoole()->exist($response->fd)) {
|
||||
return;
|
||||
}
|
||||
if (is_array($sendData)) {
|
||||
$sendData = Json::encode($sendData);
|
||||
}
|
||||
$response->end($this->setHeaders($response, $status)
|
||||
->setResponseContent($sendData));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param $sendData
|
||||
* @return string
|
||||
* @throws Exception
|
||||
*/
|
||||
private function setResponseContent($sendData): string
|
||||
{
|
||||
$message = '[' . date('Y-m-d H:i:s') . ']' . $sendData . PHP_EOL . PHP_EOL;
|
||||
|
||||
Reference in New Issue
Block a user