/** * 渲染一个视图文件,返回结果 * * @return string */ function execute() { $viewname = $this->viewname; $child = new ViewLayer($this, $viewname); $error_reporting = ini_get('error_reporting'); error_reporting($error_reporting & ~E_NOTICE); $child->parse(); $layer = $child; while (($parent = $layer->parent) != null) { $parent->parse($layer->blocks); $layer = $parent; } error_reporting($error_reporting); return $child->root()->contents; }
/** * 返回该层的顶级层(最底层的视图) * * @return \Ws\Mvc\ViewLayer */ function root() { return $this->parent ? $this->parent->root() : $this; }