config('mini_program.app_id'), 'secret' => config('mini_program.secret'), ]; $app = Factory::miniProgram($config); $phoneInfo = $app->getPhoneNumber($code); if (empty($phoneInfo)) { $this->apiError('手机号登录失败', 0, $phoneInfo); } if ($phoneInfo['errcode'] !== 0) { $this->apiError('手机号登录失败', 0, $phoneInfo); } $phone = $phoneInfo['phone_info']['phoneNumber']; dump($phone); } }