| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253 |
- <?php
- namespace app\admin\controller;
- use think\Controller;
- use think\Exception;
- use think\Request;
- use think\Session;
- use think\Log;
- use think\cache\driver\Redis;
- class Common extends Controller
- {
- /**
- * 构造函数.
- *
- * @access public
- * @return string
- */
- public function _initialize()
- {
- // 验证是否登陆.
- if (!Session::has('admin')) {
- return $this->redirect('Admin/Login/login');
- }
- }//end _initialize()
- /**
- * 获取当前模块.
- */
- protected function getModular()
- {
- $request = Request::instance();
- $controller = $request->controller();
- $module = $request->module();
- $action = $request->action();
- $path = $request->path();
- $data = [
- 'controller' => $controller,
- 'module' => $module,
- 'action' => $action,
- 'path' => $path,
- ];
- return $data;
- }//end getModular()
- }
|