123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119 |
- <?php
- namespace think\response;
- use think\Response;
- class View extends Response
- {
-
- protected $options = [];
- protected $vars = [];
- protected $config = [];
- protected $filter;
- protected $contentType = 'text/html';
-
- protected $isContent = false;
-
- protected function output($data)
- {
-
- return $this->app['view']
- ->filter($this->filter)
- ->fetch($data, $this->vars, $this->config, $this->isContent);
- }
-
- public function isContent($content = true)
- {
- $this->isContent = $content;
- return $this;
- }
-
- public function getVars($name = null)
- {
- if (is_null($name)) {
- return $this->vars;
- } else {
- return isset($this->vars[$name]) ? $this->vars[$name] : null;
- }
- }
-
- public function assign($name, $value = '')
- {
- if (is_array($name)) {
- $this->vars = array_merge($this->vars, $name);
- } else {
- $this->vars[$name] = $value;
- }
- return $this;
- }
- public function config($config)
- {
- $this->config = $config;
- return $this;
- }
-
- public function filter($filter)
- {
- $this->filter = $filter;
- return $this;
- }
-
- public function exists($name)
- {
- return $this->app['view']->exists($name);
- }
- }
|