$credential, 'accessKeyId' => $config['aliyun_access_key_id'], 'accessKeySecret' => $config['aliyun_access_key_secret'], ]); // Endpoint 请参考 https://api.aliyun.com/product/Dypnsapi $config->endpoint = "dypnsapi.aliyuncs.com"; return new Dypnsapi($config); } /** * 通过Token获取手机号 * @param string $token 客户端SDK返回的Token * @return string|null */ public static function getMobileByToken($token) { $client = self::getClient(); $createVerifySchemeRequest = new CreateVerifySchemeRequest([ 'accessToken' => $token ]); try { $response = $client->getMobileWithOptions($createVerifySchemeRequest, new RuntimeOptions([])); // var_dump($response->body);die; if ($response->body->code == 'OK') { return $response->body->getMobileResultDTO->mobile; } } catch (Exception $error) { if (!($error instanceof TeaError)) { $error = new TeaError([], $error->getMessage(), $error->getCode(), $error); } } } } $path = __DIR__ . \DIRECTORY_SEPARATOR . '..' . \DIRECTORY_SEPARATOR . 'vendor' . \DIRECTORY_SEPARATOR . 'autoload.php'; if (file_exists($path)) { require_once $path; } //NumberAuth::getMobileByToken(array_slice($token, 1));