In a Laravel controller I have this redirect:
return redirect()->back();
这让我回到上一页(比如http://domain/page页).然而,我想让页面跳转到一个特定的锚(比如#节).所以最终这一页应该打开:http://domain/page#section.我怎样才能做到这一点?我try 在重定向中添加锚,但没有效果.
In a Laravel controller I have this redirect:
return redirect()->back();
这让我回到上一页(比如http://domain/page页).然而,我想让页面跳转到一个特定的锚(比如#节).所以最终这一页应该打开:http://domain/page#section.我怎样才能做到这一点?我try 在重定向中添加锚,但没有效果.
return Redirect::to(URL::previous() . "#whatever");
记住在顶部导入它:
use Illuminate\Support\Facades\Redirect;
use Illuminate\Support\Facades\URL;
I hope this works for you!