<?php /** * Created by PhpStorm * User: 林志杰 * Email: 598287049@qq.com * Time: 2020/1/11 17:56 */ declare(strict_types=1); namespace app\common\business; use AlibabaCloud\Client\Exception\ClientException; use app\common\lib\sms\AliSms; class Sms { public static function sendCode(string $phoneNumber): bool { // 生成短信验证码 $code = random_int(100000, 999999); $sms = AliSms::sendCode($phoneNumber, $code); if ($sms) { // 将验证码记录到redis,并设置失效时间 } return true; } }