-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathHome.php
More file actions
33 lines (28 loc) · 864 Bytes
/
Home.php
File metadata and controls
33 lines (28 loc) · 864 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
require APPPATH . '/libraries/ImplementJwt.php';
class Home extends CI_Controller {
public function __construct(){
parent::__construct();
$this->load->helper('url');
$this->objOfJwt = new ImplementJwt();
}
public function index()
{
if(isset($_COOKIE['auth'])){
$decodeToken = $this->objOfJwt->DecodeToken($_COOKIE['auth']);
$user = $decodeToken;
} else {
$user = NULL;
}
$this->load->library('layout');
$this->load->model('admin_model');// 都是获取所有数据接口,可复用
$product = $this->admin_model->getProductData();
$catgory = $this->admin_model->getCatgoryData();
$data['products'] = $product;
$data['catgories'] = $catgory;
$data['user'] = $user;
// var_dump($user);
$this->layout->view('home',['data' => $data]);
}
}