1234567891011121314151617181920212223242526272829303132333435 |
- <?php
- namespace User\Lib;
- use Dever;
- class Core
- {
- protected $uid = -1;
- protected $login = true;
- public $data = array();
- public function __construct()
- {
- $this->uid = Dever::load('user/lib/info')->check(false);
- if ($this->uid <= 0) {
- $this->uid = Dever::db('user/info')->config['auto'];
- }
- $this->user = Dever::load('user/lib/info')->get($this->uid);
- if ($this->user) {
- $this->user['uid'] = $this->user['id'];
- }
- if ($this->login) {
- $this->checkLogin();
- }
- }
- public function checkLogin()
- {
- if (!$this->uid || $this->uid <= 0) {
- Dever::alert('请先登录', -2);
- }
- }
- }
|