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

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article
R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
1 months agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
1 months agoBy尊渡假赌尊渡假赌尊渡假赌
Assassin's Creed Shadows: Seashell Riddle Solution
3 weeks agoByDDD
What's New in Windows 11 KB5054979 & How to Fix Update Issues
2 weeks agoByDDD
Will R.E.P.O. Have Crossplay?
1 months agoBy尊渡假赌尊渡假赌尊渡假赌

Hot Tools

PhpStorm Mac version
The latest (2018.2.1) professional PHP integrated development tool

SAP NetWeaver Server Adapter for Eclipse
Integrate Eclipse with SAP NetWeaver application server.

SublimeText3 English version
Recommended: Win version, supports code prompts!

Atom editor mac version download
The most popular open source editor

Dreamweaver Mac version
Visual web development tools