Php 拉威尔简单短信
我尝试做,发送短信使用简单的短信Laravel包。然后用户激活他收到短信,短信内容为:已激活!,但我不会通过标签$phone收到短信,如果我像这样使用手机:“+4425652125”,一切正常。我的代码如下所示:Php 拉威尔简单短信,php,laravel,sms,Php,Laravel,Sms,我尝试做,发送短信使用简单的短信Laravel包。然后用户激活他收到短信,短信内容为:已激活!,但我不会通过标签$phone收到短信,如果我像这样使用手机:“+4425652125”,一切正常。我的代码如下所示: public function activate($token, User $user) { $user = User::whereActivationToken($token)->firstOrFail(); $user->confirmEmail();
public function activate($token, User $user)
{
$user = User::whereActivationToken($token)->firstOrFail();
$user->confirmEmail();
$phone = $user->phone;
flash()->success(trans('frontend.account.activated'));
SMS::send('Your SMS Message', null, function($sms) use ($phone) {
$sms->to($phone);
});
}
有什么想法吗?看看
“$phone”
。这是一个文本字符串,不是变量。除非需要,否则不要引用变量。可能重复的已更改为:`$sms->to($phone);`现在得到erro:Undefined variable:phone,您需要将其传递给函数。可能函数($sms)使用($phone)
@chris85没有错误,但仍然无法收到消息。仍然获得$phone而不是+445455125