本文整理汇总了PHP中Fuel::finish方法的典型用法代码示例。如果您正苦于以下问题:PHP Fuel::finish方法的具体用法?PHP Fuel::finish怎么用?PHP Fuel::finish使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Fuel
的用法示例。
在下文中一共展示了Fuel::finish方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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;
}
示例2: 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 */
示例3: 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);
}