<?phpnamespace illuminate\view\engines;use exception;use throwable;use symfony\ component\debug\exception\fatalthrowableerror;class phpengine implements engineinterface{// phpengine implements engineinterface /** * get the evaluated contents of the view. * * @param string $path * @param array $data * @return string */ public function get ($path, array $ Data = []) { return $ This->evaluatepath ($path, $data); }// get the evaluated Contents of the view. // evaluate Path /** * Get the evaluated contents of the view at the given path. * * @param string $__ path * @param array $__data * @return string */ protected Function evaluatepath ($__path, $__data) {// get the evaluated contents of the view at the given path $obLevel = ob_get_level ();// get this ob level ob_start ();// start ob extract ($__data, EXTR_SKIP);// get this data // we ' ll evaluate the contents of the view inside a try/catch block So we can // flush out any stray output that might get out before an error occurs or // an exception is thrown. This prevents any partial views from leaking. try { include $__path;/ / try get this file } catch ( exception $e) { $this Handleviewexception ($e, $oBlevel);// handle } catch (Throwable $e) { $this->handleviewexception ( New fatalthrowableerror ($e), $obLevel);// handle }// we ' ll evaluate the contents of the view inside a Try/catch block so we can // flush out any stray output that might get out before an error occurs or // an exception is thrown. this prevents any partial view from leaking. return ltrim (Ob_get_clean ()); } /** * handle a view exception. * * @ param \exception $e * @param int $obLevel * @return void * * @throws $e */ Protected function handleviewexception (exception $e, $obLevel) { while (Ob_get_level () > $obLevel) { ob_end_clean (); }// clean ever thing throw $e;// throw $e }//handle a view exception.}
This article is from the "Focus on PHP Group number: 414194301" blog, please be sure to keep this source http://jingshanls.blog.51cto.com/3357095/1846652
[Li Jingshan php] every day laravel-20161107| phpengine.php