forked from fantiq/phpframework
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathController.php
More file actions
45 lines (44 loc) · 1.07 KB
/
Copy pathController.php
File metadata and controls
45 lines (44 loc) · 1.07 KB
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
34
35
36
37
38
39
40
41
42
43
44
45
<?php
namespace framework\base;
use App;
class Controller extends Base{
private $_view = null;
protected $verify = null;
public function __construct(){
$this->verify = $this->validate->getVerify([$this->request]);
$this->_view = App::getComponent('view')->getInstance();
}
protected function getView(){
return $this->_view;
}
public function cache($expire=0){
$this->_view->cache($expire);
}
public function assign($key=null,$val=null){
$this->_view->assign($key,$val);
}
public function display($path=''){
$this->response->setBody($this->_view->display($path));
}
public function render($path='',$data=[]){
if($data!=[]){
foreach($data as $key=>$val){
if($key!=null){
$this->_view->assign($key,$val);
}
}
}
// $this->response->setBody($this->_view->display($path));
return $this->_view->display($path);
}
public function renderAjax($data=[]){
return json_encode($data);
}
public function forward($m=null,$c='',$a='',$args=[]){
$this->redirect();
}
public function redirect($url=''){
header('Location:'.$url);
exit();
}
}