20 lines
443 B
PHP
20 lines
443 B
PHP
|
<?php
|
||
|
|
||
|
namespace acs\View;
|
||
|
|
||
|
use Acast\Http\View;
|
||
|
use Workerman\Protocols\Http;
|
||
|
|
||
|
abstract class Base extends View
|
||
|
{
|
||
|
function retJson($msg, int $err = 0, ?int $http_code = null)
|
||
|
{
|
||
|
Http::header('Content-Type: application/json');
|
||
|
if (isset($http_code))
|
||
|
Http::header('HTTP', $http_code);
|
||
|
$this->_controller->retMsg = json_encode([
|
||
|
'err' => $err,
|
||
|
'data' => $msg
|
||
|
]);
|
||
|
}
|
||
|
}
|