Controller.php 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. <?php
  2. namespace WY\app\libs;
  3. use WY\app\woodyapp;
  4. use WY\app\libs\Router;
  5. use WY\app\libs\Req;
  6. use WY\app\libs\Res;
  7. use WY\app\libs\Page;
  8. use WY\app\libs\Session;
  9. use WY\app\controller\chkcode;
  10. use WY\app\libs\Model;
  11. use WY\app\Config;
  12. use WY\app\model\Verifyuser;
  13. if (!defined('WY_ROOT')) {
  14. exit;
  15. }
  16. class Controller
  17. {
  18. public $data;
  19. public $tpl = 'view/default/';
  20. function __construct()
  21. {
  22. $this->router = new Router();
  23. $this->req = new Req();
  24. $this->res = new Res();
  25. $this->page = new Page();
  26. $this->session = new Session();
  27. $this->chkcode = new chkcode();
  28. $this->config = $this->model()->select()->from('config')->fetchRow();
  29. $this->action = $this->router->put();
  30. $this->setConfig = new Config();
  31. $this->verifyUser = new Verifyuser();
  32. }
  33. public function model()
  34. {
  35. return new Model();
  36. }
  37. public function put($file, $data = array())
  38. {
  39. if ($data) {
  40. extract($data);
  41. }
  42. if (!file_exists($this->tpl . $file)) {
  43. $file = 'woodyapp.php';
  44. }
  45. require_once $this->tpl . $file;
  46. $content = ob_get_contents();
  47. ob_get_clean();
  48. echo $content;
  49. if (ob_get_level()) {
  50. ob_end_flush();
  51. }
  52. }
  53. }
  54. ?>