| 1234567891011121314151617181920212223242526272829303132333435 | <?php// 应用公共文件function ajax_return($code = 0, $msg = '', $data = []){    $res      = ['code' => $code, 'msg' => $msg, 'data' => $data];    $response = \think\Response::create($res, 'json');    throw new \think\exception\HttpResponseException($response);}function url(string $url = '', array $vars = [], $suffix = true, $domain = true){    return \think\facade\Route::buildUrl($url, $vars)->suffix($suffix)->domain($domain);}function rand_str($len = 6){    $str = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";    $res = '';    for ($i = 0; $i < $len; $i++) {        $key = rand(0, strlen($str));        $res .= $str[$key];    }    return $res;}function array_get($array, $key, $default = null){    return isset($array[$key]) ? $array[$key] : $default;}function str_get($str, $default = null){    return isset($str) ? $str : $default;}
 |