<?php
/**
 * Output class
 * @package EMLOG
 * @link https://www.emlog.net
 */

class Ret {
    public static function success($msg, $data = '') {
        header('Content-Type: application/json; charset=UTF-8');
        $result = [
            'code' => 200,
            'msg'  => $msg,
            'data' => $data
        ];
        die(json_encode($result, JSON_UNESCAPED_UNICODE));
    }


    public static function error($msg) {
        header('Content-Type: application/json; charset=UTF-8');
        $result = [
            'code' => 400,
            'msg'  => $msg,
        ];
        die(json_encode($result, JSON_UNESCAPED_UNICODE));
    }


}
