我想重定向::到一個自定義的URL使用laravel中的變量,一旦我做了一些操作。這裏是我到目前爲止的代碼:插入變量到重定向::到Laravel
Route::get('remove_comment/{id}', function($id) {
$comment = get_comment($id);
$postId = $comment->Post_Id;
remove_comment($id);
return Redirect::to(url('page/{{{$postId}}}'));
});
所以我希望它重定向到一個像/ post/1或類似的URL的頁面。它不起作用,我已經實現了它,但我確信會有辦法。是否有可能做我在問什麼?
試試這個:'return Redirect :: to(url('page /'.$ postId));' – odannyc