简体   繁体   中英

named routes with parameters in Laravel

I am building an authentication module for my application. I am now at the phase of activation. I send the link to user by email:

project/index.php/activate?email=$email?key=$key 

so I created a route in my routes.php file to handle the activate but I don't know how to pass it the arguments email and key. Also will this route be get or post?

Try this:

class MemberController extends BaseController {
    //...

    public function activate()
    {
        $email = Input::get('email');
        $key = Input::get('key');
    }
}

Route could be normally created without mentioning the query strings, you don't need to mention the query strings when creating the route, just add the query strings after the route, for example: echo route('routename')?email=emailaddress&key=keyvalue .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM