View.php.bak 617 B

1234567891011121314151617181920212223242526272829303132
  1. <?php
  2. namespace WY\app\libs;
  3. if (!defined('WY_ROOT')) {
  4. exit;
  5. }
  6. class View
  7. {
  8. public $params = array();
  9. public $tpl;
  10. public function assign($data)
  11. {
  12. $this->params = $data;
  13. }
  14. public function put($file, $data = array())
  15. {
  16. if ($data) {
  17. extract($data);
  18. }
  19. if (!file_exists($this->tpl . $file)) {
  20. $file = 'woodyapp.php';
  21. }
  22. require_once $this->tpl . $file;
  23. $content = ob_get_contents();
  24. ob_get_clean();
  25. echo $content;
  26. if (ob_get_level()) {
  27. ob_end_flush();
  28. }
  29. }
  30. }
  31. ?>