forked from assimon/dujiaoka
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathController.php
67 lines (65 loc) · 1.63 KB
/
Controller.php
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
<?php
namespace YS\app\libs;
use YS\app\ysapp;
use YS\app\libs\Router;
use YS\app\libs\Req;
use YS\app\libs\Res;
use YS\app\libs\Page;
use YS\app\libs\Session;
use YS\app\controller\chkcode;
use YS\app\libs\Model;
use YS\app\Config;
use YS\app\model\Verifyuser;
class Controller
{
public $data;
public $tpl = 'view/default/';
function __construct()
{
$this->router = new Router();
$this->req = new Req();
$this->res = new Res();
$this->page = new Page();
$this->session = new Session();
$this->chkcode = new chkcode();
$this->config = $this->model()->select()->from('config')->fetchRow();
$this->action = $this->router->put();
$this->setConfig = new Config();
$this->verifyUser = new Verifyuser();
$this->urlbase = strcasecmp($_SERVER['HTTPS'],"ON")==0?"https://":"http://";
}
public function model()
{
return new Model();
}
public function put($file, $data = array())
{
if ($data) {
extract($data);
}
if (!file_exists($this->tpl . $file)) {
$file = 'ysapp.php';
}
require_once $this->tpl . $file;
$content = ob_get_contents();
ob_get_clean();
echo $content;
if (ob_get_level()) {
ob_end_flush();
}
}
/**获取所有数组
* @return array
*/
public function getReqdata($mod)
{
$data = array();
if (isset($mod)) {
foreach ($mod as $key => $val) {
$data[$key] = $this->req->request($key);
}
}
return $data;
}
}
?>