| 1234567891011121314151617181920212223 |
- <?php
- namespace App\Services;
- class SmsService
- {
- private static string $uri = "https://api.smsbao.com/sms";
- private static string $username = "even7788";
- private static string $password = "Lpy@19920122";
- private static string $content = "【二八科技】您的验证码是{code}。如非本人操作,请忽略本短信";
- public static function sendPhoneCode($phone)
- {
- $code = mt_rand(100000, 999999);
- $content = str_replace("{code}", $code, static::$content);
- $url = static::$uri . "?u=" . static::$username . "&p=" . static::$password;
- $url .= "&c=" . urlencode($content);
- $url .= "&m=" . $phone;
- $res = file_get_contents($url);
- return $res;
- }
- }
|