laravel 如何在laravel中检查和控制以前的网址?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/31920419/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to check and control previous url in laravel?
提问by Tolga Ate?
I have a multi-step form. There are steps like : step 1 , step 2 ... step 5.
我有一个多步骤的表格。有如下步骤:第 1 步、第 2 步……第 5 步。
How can i check people should follow this steps ? Is there a way to check if he comes from previous-true url(step) or any other way ?
我如何检查人们是否应该遵循此步骤?有没有办法检查他是否来自以前的真实网址(步骤)或任何其他方式?
Thanks !
谢谢 !
回答by cre8
URL::previous() will return the referrer url. If you want to prevent that they use cross-site request forgeries use laravel's csrf-protection. http://laravel.com/docs/5.1/routing#csrf-protection
URL::previous() 将返回引荐来源网址。如果您想防止他们使用跨站点请求伪造,请使用 laravel 的 csrf 保护。 http://laravel.com/docs/5.1/routing#csrf-protection