通过模板引擎响应输出HTML

@param array $data 待渲染KV数据
@param string|null $view 文件名
@throws \Exception
@throws \Throwable
@throws Exception
@return void
336918
public function outputView(array $data, $view = null)
    {
        $this->getContext()->getOutput()->outputView($data, $view);
    }
711892
public function view(string $view, array $data = [])
  {
    $path = $this->viewsDirectory . $this->DS . $this->cleanPath($view) . $this->viewsExtension;
    $this->verify($path);
    $this->registerDirectives();

    $compiler = new Compiler($this->cacheDirectory, $this->viewsDirectory, $this->viewsExtension, $this->directives, $this->engine);
    $compiler->makeView($path, $data);
    return $this;
  }
486423
public function create($view = null, array $data = [])
    {
        if (is_null($view)) {
            return $this;
        }

        return $this->render($view, $data, true)->content();
    }
1286265
public function render(string $view = null, array $data = [], string $formAction = ''): string
    {
        if (!$this->_data) {
            return '';
        }

        return $this->_data->setPath($formAction)->appends($data)->render($view)->toHtml();
    }
1371163
public static function send($view, array $data, $callback)
    {
        list($html, $plain) = self::parseView($view);

        $mailer = self::getMailer();

        $data['message'] = $message = self::createMessage();

        call_user_func($callback, $message);

        self::addContent($message, $html, $plain, $data);

        $message = $message->getSwiftMessage();

        return $mailer->send($message);
    }
86346
protected function view($view, $data = [], $auto_filter = null)
	{
		return \View::forge($view, $data, $auto_filter);
	}
1204970
public function plain($view, array $data, $callback=null)
    {
        return $this->send(['text'=>$view], $data, $callback);
    }
811068
public function send($view, array $data = [], $callback = null)
    {

        if ($view instanceof MailableContract) {
            return $this->sendMailable($view);
        }
        list($view, $plain, $raw) = $this->parseView($view);

        $from   = app('antares.memory')->make('primary')->get('email.from');
        $config = app('config')->get('mail.from');

        $this->from = ['address' => array_get($from, 'address', array_get($config, 'address')), 'name' => array_get($from, 'name', array_get($config, 'name'))];

        $data['message'] = $message         = $this->createMessage();

        $this->addContent($message, $view, $plain, $raw, $data);
        call_user_func($callback, $message);

        if (isset($this->to['address'])) {
            $this->setGlobalTo($message);
        }

        $swiftMessage = $message->getSwiftMessage();
        if ($this->shouldSendMessage($swiftMessage)) {
            $this->sendSwiftMessage($swiftMessage);

            $this->dispatchSentEvent($message);
        }
    }
1234539
public function send($view, array $data = [], $callback = null)
    {
        if ($view instanceof MailableContract) {
            return $this->sendMailable($view);
        }

        // First we need to parse the view, which could either be a string or an array
        // containing both an HTML and plain text versions of the view which should
        // be used when sending an e-mail. We will extract both of them out here.
        [$view, $plain, $raw] = $this->parseView($view);

        $data['message'] = $message = $this->createMessage();

        // Once we have retrieved the view content for the e-mail we will set the body
        // of this message using the HTML type, which will provide a simple wrapper
        // to creating view based emails that are able to receive arrays of data.
        call_user_func($callback, $message);

        $this->addContent($message, $view, $plain, $raw, $data);

        // If a global "to" address has been set, we will set that address on the mail
        // message. This is primarily useful during local development in which each
        // message should be delivered into a single mail address for inspection.
        if (isset($this->to['address'])) {
            $this->setGlobalToAndRemoveCcAndBcc($message);
        }

        // Next we will determine if the message should be sent. We give the developer
        // one final chance to stop this message and then we will send it to all of
        // its recipients. We will then fire the sent event for the sent message.
        $swiftMessage = $message->getSwiftMessage();

        if ($this->shouldSendMessage($swiftMessage, $data)) {
            $this->sendSwiftMessage($swiftMessage);

            $this->dispatchSentEvent($message, $data);
        }
    }
961661
public function links($view = "default", $data = [])
    {
        extract($data);

        $paginator = $this;

        $elements = $this->elements();

        require dirname(__FILE__) . "/pagination/" . $view . ".php";
    }
1373604
public function view($view, $data = [], $mergeData = [])
    {
        return $this->app['view']->make($this->viewname($view), $data, $mergeData);
    }
328362
protected function renderView($view, $data)
    {
        return $view instanceof Htmlable
                        ? $view->toHtml()
                        : $this->views->make($view, $data)->render();
    }
553034
public function renderText($view, array $data = [])
    {
        $this->view->flushFinderCache();

        $contents = $this->view->replaceNamespace(
            'mail', $this->textComponentPaths()
        )->make($view, $data)->render();

        return new HtmlString(
            html_entity_decode(preg_replace("/[\r\n]{2,}/", "\n\n", $contents), ENT_QUOTES, 'UTF-8')
        );
    }
933167
public function renderEach($view, $data, $iterator, $empty = 'raw|')
    {
        $result = '';

        // If is actually data in the array, we will loop through the data and append
        // an instance of the partial view to the final result HTML passing in the
        // iterated value of this data array, allowing the views to access them.
        if (count($data) > 0) {
            foreach ($data as $key => $value) {
                $result .= $this->make(
                    $view, ['key' => $key, $iterator => $value]
                )->render();
            }
        }

        // If there is no data in the array, we will render the contents of the empty
        // view. Alternatively, the "empty view" could be a raw string that begins
        // with "raw|" for convenience and to let this know that it is a string.
        else {
            $result = Str::startsWith($empty, 'raw|')
                        ? substr($empty, 4)
                        : $this->make($empty)->render();
        }

        return $result;
    }
136617
public static function render_each($view, array $data, $iterator, $empty = 'raw|')
	{
		$result = '';

		// If is actually data in the array, we will loop through the data and
		// append an instance of the partial view to the final result HTML,
		// passing in the iterated value of the data array.
		if (count($data) > 0)
		{
			foreach ($data as $key => $value)
			{
				$with = array('key' => $key, $iterator => $value);

				$result .= render($view, $with);
			}
		}

		// If there is no data in the array, we will render the contents of
		// the "empty" view. Alternatively, the "empty view" can be a raw
		// string that is prefixed with "raw|" for convenience.
		else
		{
			if (starts_with($empty, 'raw|'))
			{
				$result = substr($empty, 4);
			}
			else
			{
				$result = render($empty);
			}
		}

		return $result;
	}
1093179
public function output($view, $data = [])
    {
        $path = $this->processOutput($view, $data);

        $content = file_get_contents($path);

        @unlink($path);

        return $content;
    }
287155
public function output($view, array $data = null)
	{
		$response = new Response($this->render($view, $data), Response::HTTP_OK, ['Content-Type' => 'text/html']);
		$response->send();
	}