我有一条命名路线
Route::get('login/facebook', array(
'as' > 'login.facebook.authorise',
'uses' => 'AuthController@getFBAuthorise'
));
并且想要生成一个指向它的 URL,并附加一个查询字符串。
例如:
URL::route('login.facebook.authorise', array("next"=>'/dashboard/')
会产生
/login/facebook?next=/dashboard/
框架中是否内置了类似的内容?如果没有,尝试执行此操作的最佳方法是什么?
谢谢。
最佳答案
URL 助手可以做到这一点。
http://laravel.com/docs/helpers#urls
echo link_to_route('route.name', $title, $parameters = array(), $attributes = array());
编辑:仅获取 URL:
http://laravel.com/docs/routing#named-routes
$url = URL::route('route.name', $parameters);
关于string - 在 Laravel 4 中生成查询字符串,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17216221/