控制器没有正确地将值传递给laravel中的route.php

时间:2015-01-24 00:10:58

标签: php laravel-4

嘿伙计们,我的AccountController.php文件中有以下代码

if($create){

                    Mail::send('emails.auth.activate' , array( 'link' => URL::route('account-activate' , $code) , 'username' => $username ) , function($message) use ($create) {
                            $message->to($create->email , $create->username)->subject('Activate your account');
                    });

                    return Redirect::route('home')
                            ->with('global' , 'your account has been created! we have sent you an email to activate you account ');
                }

现在这部分在上面的代码中:

array( 'link' => URL::route('account-activate' , $code)

假设将$ code值发送到:

Route::get('/account/activate/{code}', array(
            'as' => 'account-activate',
            'uses' => 'AccountController@getActivate'
        ));

在route.php中。

正如您所看到的,从AccountController调用getActivate方法,如下所示:

 public function getActivate($code){
       echo  $code
}

回显的值是{code},而不是$ code的实际值。

我到底错过了什么。我已经完成了相同的教程2-3次,我完全按照那个人的方式进行操作,所以我真的不知道我错过了什么。我也检查了我的syntex,一切似乎都很好。我在laravel中启用了错误。

为什么我的控制器无法正确传递值?

0 个答案:

没有答案
相关问题