Home  >  Article  >  php教程  >  ThinkPHP链接MongoDB的用户权限验证代码

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

WBOY
WBOYOriginal
2016-06-07 11:38:021119browse

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元

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