当前位置: 首页>>代码示例>>PHP>>正文


PHP Error::render方法代码示例

本文整理汇总了PHP中Error::render方法的典型用法代码示例。如果您正苦于以下问题:PHP Error::render方法的具体用法?PHP Error::render怎么用?PHP Error::render使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Error的用法示例。


在下文中一共展示了Error::render方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: render

 public function render($vars = null)
 {
     // Autoloads
     // juste avant l'affichage pour que les components soit tous déjà chargés pour les transmitions aux helpers
     foreach ($this->_params["helpers"] as $key => $value) {
         if (is_numeric($key)) {
             $this->load($value);
         } else {
             $this->load($key, $value);
         }
     }
     if ($vars != null) {
         extract($vars);
     }
     if (file_exists("app/frontend/views/themes/" . $this->_defaultTheme . '/index.php')) {
         include "app/frontend/views/themes/" . $this->_defaultTheme . '/index.php';
     } else {
         Error::render(3, $this->_defaultTheme);
     }
 }
开发者ID:fozeek,项目名称:framework,代码行数:20,代码来源:Html.php

示例2: testException

 /**
  * @expectedException Error
  */
 public function testException()
 {
     $e = new Error(400, "This is message", 8);
     $e->render();
 }
开发者ID:alkemann,项目名称:h2l,代码行数:8,代码来源:ErrorTest.php

示例3: handler

	/**
	 * Replaces Kohana's `Kohana::exception_handler()` method. This does the
	 * same thing, but also adds email functionality and the ability to perform
	 * an action in response to the exception. These actions and emails are
	 * customizable per type in the config file for this module.
	 *
	 * @uses		Kohana::exception_text
	 * @param \Exception $e
	 * @internal param \exception $object object
	 * @return	boolean
	 */
	public static function handler(Exception $e)
	{
		try
		{
			$error = new Error();

			// Get the exception information
			$error->exception = $e;
			$error->type = get_class($e);
			$error->code = $e->getCode();
			$error->message = $e->getMessage();
			$error->file = $e->getFile();
			$error->line = $e->getLine();
			$error->request_initial = Request::initial();

			// Create a text version of the exception
			$error->text = Kohana_Exception::text($e);

			if (Kohana::$is_cli)
			{
				// Display the text of the exception
				echo "\n{$error->text}\n";
			}

			// Get the exception backtrace
			$error->trace = $e->getTrace();

			if ($e instanceof ErrorException)
			{
				if (version_compare(PHP_VERSION, '5.3', '<'))
				{
					// Workaround for a bug in ErrorException::getTrace() that exists in
					// all PHP 5.2 versions. @see http://bugs.php.net/bug.php?id=45895
					for ($i = count($error->trace) - 1;$i > 0;--$i)
					{
						if (isset($error->trace[$i - 1]['args']))
						{
							// Re-position the args
							$error->trace[$i]['args'] = $error->trace[$i - 1]['args'];

							// Remove the args
							unset($error->trace[$i - 1]['args']);
						}
					}
				}
			}

			if (!headers_sent() and (Kohana::$is_cli === false))
			{
				// Make sure the proper content type is sent with a 500 status
				header('Content-Type: text/html; charset=' . Kohana::$charset, true, 500);
			}

			// Get the contents of the output buffer
			$error->display = $error->render();

			// Log the error
			$error->log();

			// Email the error
			$error->email();

			// Respond to the error
			$error->action();

			return true;
		}
		catch (Exception $e)
		{
			// Log an error.
			if (is_object(Kohana::$log))
			{
				// Create a text version of the exception
				$error = Kohana_Exception::text($e);

				// Add this exception to the log
				Kohana::$log->add(Log::ERROR, $error);

				// Make sure the logs are written
				Kohana::$log->write();
			}

			// Clean the output buffer if one exists
			ob_get_level() and ob_clean();

			// Display the exception text
			header('HTTP/1.1 500 Internal Server Error');
			echo "Unknown Error - Exception thrown in Error::handler()";

//.........这里部分代码省略.........
开发者ID:nexeck,项目名称:kohana-errors,代码行数:101,代码来源:error.php

示例4: load

 /**
  * Permet de charger la View avec son template
  * @return string Contenu de la View après son rendu, et avec le template. Oui monsieur !!! =)
  */
 public function load()
 {
     header('HTTP/1.0 ' . $this->httpCode . ' ' . $this->httpCodes[$this->httpCode]);
     $viewFile = APP . '/View/' . Path::ds($this->viewName) . '.php';
     $templateFile = APP . '/Template/' . Path::ds($this->templateName) . '.php';
     if (file_exists($viewFile)) {
         extract(array_merge(compact('this'), $this->vars));
         ob_start();
         include $viewFile;
         $content = ob_get_clean();
         if (file_exists($templateFile)) {
             include $templateFile;
             return ob_get_clean();
         } else {
             return Error::render('missingTemplate', ['template' => $this->templateName]);
         }
     } else {
         return Error::render('missingView', ['view' => $this->viewName]);
     }
 }
开发者ID:Kocal,项目名称:PHP-Framework,代码行数:24,代码来源:View.php

示例5: loadError

 /**
  * Carrega a página de erro de acordo com as configurações e mata a execução
  * @param	object	$error	instância de Exception
  * @return	void
  */
 private function loadError($error)
 {
     Error::render($error->getCode(), $error->getMessage(), $error->getFile(), $error->getLine(), $error->getTraceAsString(), method_exists($error, 'getDetails') ? $error->getDetails() : '');
 }
开发者ID:nylmarcos,项目名称:estagio,代码行数:9,代码来源:App.php


注:本文中的Error::render方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。