basePath() . '/config' . ($path ? '/' . $path : $path); } function subtext($text, $length) { if(mb_strlen($text, 'utf8') > $length) { return mb_substr($text, 0, $length, 'utf8').'...'; } else { return $text; } } } function http($url, $param, $method = 'post') { try { $client = new \GuzzleHttp\Client(); $response = $client->request($method, $url, $param); $result = json_decode($response->getBody()->getContents(), true); if ($result['code'] == 0) { return $result['data']; } else { return []; } } catch (\Exception $exception) { return []; } }