Home > php教程 > php手册 > 令牌验证函数单独拿出来

令牌验证函数单独拿出来

WBOY
Release: 2016-06-07 11:45:29
Original
1479 people have browsed it

以往的话都是在某个模型对象中使用->autoCheckToken($_POST)来手动验证令牌。
今天提交一个表单,但是没有涉及到数据查询与操作。但是需要验证令牌,如果再去实例化一个模型,太麻烦了。
把令牌验证方法提取出来,放到我们自己的公共模块或者公共方法中,即可直接调用啦。
打开./ThinkPHP/lib/core/Model.class.php
找到
public function autoCheckToken
将这个函数复制出来,放到公共模块commonAction.class.php中
其他模块继承commonAction,即可直接使用
$this->autoCheckToken($_data)
来验证令牌啦

AD:真正免费,域名+虚机+企业邮箱=0元

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template