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


PHP Event::shutdown方法代码示例

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


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

示例1: handle

 /**
  * When this type of exception isn't caught this method is called by
  * Error::exception_handler() to deal with the problem.
  */
 public function handle()
 {
     $response = new \Response(\View::forge('404'), 404);
     \Event::shutdown();
     $response->send(true);
     return;
 }
开发者ID:quickpacket,项目名称:noclayer,代码行数:11,代码来源:request.php

示例2: redirect

 /**
  * Redirects to another uri/url.  Sets the redirect header,
  * sends the headers and exits.  Can redirect via a Location header
  * or using a refresh header.
  *
  * The refresh header works better on certain servers like IIS.
  *
  * @access	public
  * @param	string	The url
  * @param	string	The redirect method
  * @param	int		The redirect status code
  * @return	void
  */
 public static function redirect($url = '', $method = 'location', $redirect_code = 302)
 {
     static::$status = $redirect_code;
     if (strpos($url, '://') === false) {
         $url = Uri::create($url);
     }
     if ($method == 'location') {
         static::set_header('Location', $url);
     } elseif ($method == 'refresh') {
         static::set_header('Refresh', '0;url=' . $url);
     } else {
         return;
     }
     Event::shutdown();
     static::send_headers();
     exit;
 }
开发者ID:hymns,项目名称:fuel,代码行数:30,代码来源:output.php

示例3: redirect

 /**
  * Redirects to another uri/url.  Sets the redirect header,
  * sends the headers and exits.  Can redirect via a Location header
  * or using a refresh header.
  *
  * The refresh header works better on certain servers like IIS.
  *
  * @param   string  $url     The url
  * @param   string  $method  The redirect method
  * @param   int     $code    The redirect status code
  * @return  void
  */
 public static function redirect($url = '', $method = 'location', $code = 302)
 {
     $response = new static();
     $response->set_status($code);
     if (strpos($url, '://') === false) {
         $url = $url !== '' ? \Uri::create($url) : \Uri::base();
     }
     if ($method == 'location') {
         $response->set_header('Location', $url);
     } elseif ($method == 'refresh') {
         $response->set_header('Refresh', '0;url=' . $url);
     } else {
         return;
     }
     \Event::shutdown();
     $response->send(true);
     exit;
 }
开发者ID:gilyaev,项目名称:framework-bench,代码行数:30,代码来源:response.php

示例4: call_user_func

// Use an anonymous function to keep the global namespace clean
call_user_func(function () {
    /**
     * Set all the paths here
     */
    $app_path = '../fuel/app/';
    $package_path = '../fuel/packages/';
    $core_path = '../fuel/core/';
    /**
     * Website docroot
     */
    define('DOCROOT', __DIR__ . DIRECTORY_SEPARATOR);
    !is_dir($app_path) and is_dir(DOCROOT . $app_path) and $app_path = DOCROOT . $app_path;
    !is_dir($core_path) and is_dir(DOCROOT . $core_path) and $core_path = DOCROOT . $core_path;
    !is_dir($package_path) and is_dir(DOCROOT . $package_path) and $package_path = DOCROOT . $package_path;
    define('APPPATH', realpath($app_path) . DIRECTORY_SEPARATOR);
    define('PKGPATH', realpath($package_path) . DIRECTORY_SEPARATOR);
    define('COREPATH', realpath($core_path) . DIRECTORY_SEPARATOR);
});
// Get the start time and memory for use later
defined('FUEL_START_TIME') or define('FUEL_START_TIME', microtime(true));
defined('FUEL_START_MEM') or define('FUEL_START_MEM', memory_get_usage());
// Boot the app
require_once APPPATH . 'bootstrap.php';
// Generate the request, execute it and send the output.
echo Request::factory()->execute()->send_headers()->output();
// Fire off the shutdown event
Event::shutdown();
// Do some final cleanup
Fuel::finish();
/* End of file index.php */
开发者ID:hymns,项目名称:fuel,代码行数:31,代码来源:index.php

示例5: download

 /**
  * Download a file
  *
  * @param  string       file path
  * @param  string|null  custom name for the file to be downloaded
  * @param  string|null  custom mime type or null for file mime type
  * @param  string|File_Area|null  file area name, object or null for base area
  * @param  bool        if false, return instead of exit
  */
 public static function download($path, $name = null, $mime = null, $area = null, $exit = true)
 {
     $info = static::file_info($path, $area);
     empty($mime) and $mime = $info['mimetype'];
     empty($name) and $name = $info['basename'];
     if (!($file = static::open_file(@fopen($info['realpath'], 'rb'), LOCK_SH, $area))) {
         throw new \FileAccessException('Filename given could not be opened for download.');
     }
     while (ob_get_level() > 0) {
         ob_end_clean();
     }
     ini_get('zlib.output_compression') and ini_set('zlib.output_compression', 0);
     !ini_get('safe_mode') and set_time_limit(0);
     header('Content-Type: ' . $mime);
     header('Content-Disposition: attachment; filename="' . $name . '"');
     header('Content-Description: File Transfer');
     header('Content-Length: ' . $info['size']);
     header('Content-Transfer-Encoding: binary');
     header('Expires: 0');
     header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
     while (!feof($file)) {
         echo fread($file, 2048);
     }
     static::close_file($file, $area);
     if ($exit) {
         \Event::shutdown();
         exit;
     }
 }
开发者ID:rysk92,项目名称:fuelphpbase,代码行数:38,代码来源:file.php

示例6: show_404

 /**
  * Shows a 404.  Checks to see if a 404_override route is set, if not show
  * a default 404.
  *
  * Usage:
  *
  *     Request::show_404();
  *
  * @param   bool         Whether to return the 404 output or just output and exit
  * @return  void|string  Void if $return is false, the output if $return is true
  */
 public static function show_404($return = false)
 {
     logger(Fuel::L_INFO, 'Called', __METHOD__);
     // This ensures that show_404 doesn't recurse indefinately
     static $call_count = 0;
     $call_count++;
     if ($call_count == 1) {
         // first call, route the 404 route
         $route_request = true;
     } elseif ($call_count == 2) {
         // second call, try the 404 route without routing
         $route_request = false;
     } else {
         // third call, there's something seriously wrong now
         exit('It appears your _404_ route is incorrect.  Multiple Recursion has happened.');
     }
     if (\Config::get('routes._404_') === null) {
         $response = new \Response(\View::factory('404'), 404);
         if ($return) {
             return $response;
         }
         \Event::shutdown();
         $response->send(true);
     } else {
         $request = \Request::factory(\Config::get('routes._404_'), $route_request)->execute();
         if ($return) {
             return $request->response;
         }
         \Event::shutdown();
         $request->response->send(true);
     }
     \Fuel::finish();
     exit;
 }
开发者ID:469306621,项目名称:Languages,代码行数:45,代码来源:request.php

示例7: handle

 /**
  * When this type of exception isn't caught this method is called by
  * Error::exception_handler() to deal with the problem.
  */
 public function handle()
 {
     $response = $this->response();
     \Event::shutdown();
     $response->send(true);
 }
开发者ID:wushian,项目名称:MDD,代码行数:10,代码来源:httpexception.php

示例8: handle

 /**
  * When this type of exception isn't caught this method is called by
  * Error::exception_handler() to deal with the problem.
  */
 public function handle()
 {
     $response = new \Response(\View::forge('500'), 500);
     \Event::shutdown();
     $response->send(true);
 }
开发者ID:quickpacket,项目名称:noclayer,代码行数:10,代码来源:httpexception.php

示例9: build

 /**
  * Build
  * 
  * Builds the grid and renders
  * it as a View object
  * 
  * @access	public
  * @return	View
  */
 public function build()
 {
     // Make sure we have columns
     if (!$this->get_columns()->count()) {
         throw new Exception('You must add a column to the grid before building it');
     }
     $this->_prepare_grid();
     // Build the grid
     $grid = \View::forge(\Config::get('grid.view.grid', 'grid'))->set('grid', $this, false);
     // If we can't display a container just return
     // the grid
     if (!$this->can_display_container()) {
         // If we're dealing with an
         // AJAX request, we want to
         // stream a new response
         if (\Input::is_ajax() and $this->should_override_response()) {
             // Create and send a response
             // with the grid as the contents
             $response = new \Response($grid);
             $response->send(true);
             // Close down fuel
             \Event::shutdown();
             \Fuel::finish();
             exit;
         }
         // Return the grid
         return $grid;
     }
     // If we can display a container, add it
     // and return both of them
     return $this->get_container()->build()->set('grid', $grid, false);
 }
开发者ID:EdgeCommerce,项目名称:edgecommerce,代码行数:41,代码来源:grid.php


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