php tp5 防多次提交的

1.在登陆也存Session::set('codes', mt_rand(1000, 9999));

2.在post提交数加上codes值一起提交,<input type="hidden" name="codes" value="{:session('codes')}">;

3.提交到方法的哪里写,

if($_POST['codes'] != Session::get('codes')){
$this->error('正在处理您的请求请稍后~','Futures/withdraw');
}
Session::set('codes',mt_rand(1000,9999));

posted @ 2019-06-26 15:39  你我他哈  阅读(905)  评论(0编辑  收藏  举报