Twilio没有在Laravel 5.2中发送短信

时间:2017-09-14 09:46:30

标签: php laravel-5.2 twilio

使用此代码:

use App\Helpers\Helper;

  public function send_otp(Request $request)
    {

      $phone      = "+".$request->mobile; 
        $checkPhone = User::where('mobile', $phone)->first();

    if(count($checkPhone) == 0) {
            $six_digit_random_number = mt_rand(100000, 999999);
            $message    = "Your one time verification code is $six_digit_random_number"; 
            Helper::send_twilio_sms($phone, $message);
            $response_array = array('success'=>true,'code'=>$six_digit_random_number,'message'=>'OTP Code has been sent succesfully');
        } else {
            $response_array = array('success'=>false,'code'=>'','message'=>'The mobile number is in already use.');
        }

       $response = response()->json($response_array, 200);
       return $response;
}

短信未发送,移动应用未收到消息。

0 个答案:

没有答案