getAccessToken(); $url = "https://api.weixin.qq.com/wxa/genwxashortlink?access_token=$accessToken"; $data = [ 'page_url' => $page_url, 'page_title' => $page_title, 'is_permanent' => $is_permanent, ]; $result = $this->post($url, helper::jsonEncode($data)); $response = $this->jsonDecode($result); if (!empty($response['link'])) { return $response['link']; } return $response['errmsg'] ?? ''; } }