传递闭包变量的Netbeans中的Laravel 4错误

时间:2014-04-28 20:51:53

标签: php laravel laravel-4

在Netbeans中,我收到以下语法错误:

if($user){ 
    Mail::send('emails.auth.activate', array('link' => URL::route('account-activate'), 'username' => $username), function($message) use $user{
    $message->to($user->email, $user->username)->subject('activate your account'); 
    }); 
    return Helper_Response::success($user); 
} 

错误是:

Unexpected variable $user 

我看不出有什么问题。任何的想法?

enter image description here

1 个答案:

答案 0 :(得分:0)

您必须在闭包use子句中使用括号:

$closure = function($message) use ($user) { 
   ...
};