naprawa logiki i update stylu
This commit is contained in:
+9
-2
@@ -4,15 +4,22 @@ namespace ComCen\Http;
|
||||
|
||||
use Ratchet\ConnectionInterface;
|
||||
|
||||
/*
|
||||
Access-Control-Allow-Origin: *
|
||||
zezwala na urzycie portu 8080
|
||||
portalowi chodzącemu na porcie 8000
|
||||
*/
|
||||
|
||||
|
||||
class Utils
|
||||
{
|
||||
static function responeJson(ConnectionInterface $conn, string $head, string $jsonData): void
|
||||
{
|
||||
$conn->send("HTTP/1.1 {$head}\r\nContent-Type: application/json\r\n\r\n{$jsonData}");
|
||||
$conn->send("HTTP/1.1 {$head}\r\nContent-Type: application/json\r\nAccess-Control-Allow-Origin: *\r\n\r\n{$jsonData}");
|
||||
}
|
||||
|
||||
static function respondHtml(ConnectionInterface $conn, string $html): void
|
||||
{
|
||||
$conn->send("HTTP/1.1 200 OK\r\nContent-Type: text/html\r\n\r\n{$html}");
|
||||
$conn->send("HTTP/1.1 200 OK\r\nContent-Type: text/html\r\nAccess-Control-Allow-Origin: *\r\n\r\n{$html}");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user