如何更改laravel路由链接

时间:2015-02-06 14:25:41

标签: php laravel-4

好的,我从以下代码中获得了一个链接:

www.mysite.com/public/myRoute?id=11223355

但是,我想更改链接的ID部分。我怎么能这样做?

路线:

Route::get('myRoute', array(
    'uses' => 'myController@myRoute',
    'as' => 'myRoute'
));

控制器在这里:

class myController extends BaseController{
   public function myRoute(){
      return View::make('pages.myPage');
   }
}

home.blade.php这里:

{{ HTML::linkRoute('myRoute', 'myLink' , array('id' => '11223355'), array('class' => 'text text-center')) }}

1 个答案:

答案 0 :(得分:2)

Route::get('myRoute/{id}', array(
    'uses' => 'myController@myRoute',
    'as' => 'myRoute'
));


class myController extends BaseController{
   public function myRoute($id){
      return View::make('pages.myPage');
   }
}

{{ HTML::linkRoute('myRoute', 'myLink' , array('11223355'), array('class' => 'text text-center')) }}