mirror of
https://github.com/bitinflow/expose.git
synced 2026-03-13 21:45:55 +00:00
23 lines
454 B
PHP
23 lines
454 B
PHP
<?php
|
|
|
|
use GuzzleHttp\Psr7\Response;
|
|
use function GuzzleHttp\Psr7\str;
|
|
|
|
function respond_json($responseData, int $statusCode = 200)
|
|
{
|
|
return str(new Response(
|
|
$statusCode,
|
|
['Content-Type' => 'application/json'],
|
|
json_encode($responseData)
|
|
));
|
|
}
|
|
|
|
function respond_html(string $html, int $statusCode = 200)
|
|
{
|
|
return str(new Response(
|
|
$statusCode,
|
|
['Content-Type' => 'text/html'],
|
|
$html
|
|
));
|
|
}
|