Home > php教程 > php手册 > body text

ThinkPHP链接MongoDB的用户权限验证代码

WBOY
Release: 2016-06-07 11:38:02
Original
1117 people have browsed it

ThinkPHP MongoDB Auth 用户权限验证代码 源代码分享
欢迎大家多提宝贵建议,请参考下面代码:

适用于 ThinkPHP 3.2.3
用法如下:


namespace Home\Controller;

use Think\Controller;

class CommonController extends Controller {

public function __construct() {
parent::__construct();
header("Content-type: text/html; charset=utf-8");

if (C('AUTH_CONFIG')) {
$uid = session($uid);
$auth = new \Think\Antauth();
if (!$auth->check(MODULE_NAME . '/' . CONTROLLER_NAME . '/' . ACTION_NAME, $uid )) {
$this->error('没有访问权限');
}
}
}

}

ThinkPHP链接MongoDB的用户权限验证代码

请下载源代码。

附件 Auth-mongo.zip ( 3.67 KB 下载:25 次 )

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
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!