防止地址栏的跳转

PHP页面:

<?php
namespace appindexcontroller;

use thinkController;
use thinkDb;
use thinkRequest;
use thinkSession;

class Commen extends Controller
{
//初始化
public function _initialize()
{
//判断session的值
if(!Session::get("user",'think'))
{
$this->error("非法登录");
}
$this->power_cat();
}
//查看权限
public function power_cat()
{
$request=Request::instance();
$controller=$request->controller();//当前控制器
$action=$request->action();//当前方法名
$data=Session::get("data",'think');
$falg=false;
foreach ($data as $k=>$v)
{
if($v['action_name']==$action)
{
$falg=true;
}
}
if(!$falg)
{
$this->error("对不起,您没有权限");
}
}
}
你所浪费的今天是那些死去的人所奢望的明天,你所厌恶的现在是未来的你所回不去的曾经。
原文地址:https://www.cnblogs.com/stj123/p/9789513.html