本文整理汇总了PHP中Fuel::env方法的典型用法代码示例。如果您正苦于以下问题:PHP Fuel::env方法的具体用法?PHP Fuel::env怎么用?PHP Fuel::env使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Fuel
的用法示例。
在下文中一共展示了Fuel::env方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: test_set_cache
public function test_set_cache()
{
// Save the environment. While we're at it, save the whales, too.
$backup = \Fuel::$env;
/*******************
* TEST A
*/
// Configure the environment to something that shouldn't allow for caching.
\Fuel::$env = 'private';
\Utility::set_cache('test_set_cache', 'testvalue');
try {
\Cache::get('test_set_cache');
\Fuel::$env = $backup;
// Delete it for subsequent nuns.
\Cache::delete('test_set_cache');
$this->fail;
} catch (\CacheNotFoundException $e) {
//The private and development environments should not cache the requests using \Utility.
}
/*******************
* TEST B
*/
// Set the environment to allow for caching.
\Fuel::$env = 'test';
\Utility::set_cache('test_set_cache', 'testvalue');
try {
\Cache::get('test_set_cache');
} catch (\CacheNotFoundException $e) {
//The private and development environments should not cache the requests using \Utility.
\Fuel::$env = $backup;
$this->fail;
}
// Delete it for subsequent nuns.
\Cache::delete('test_set_cache');
// Restore the environment. (Eden?)
\Fuel::$env = $backup;
}
示例2: isset
<?php
ini_set('default_charset', 'UTF-8');
// Bootstrap the framework DO NOT edit this
require COREPATH . 'bootstrap.php';
\Autoloader::add_classes(array());
// Register the autoloader
\Autoloader::register();
/**
* Your environment. Can be set to any of the following:
*
* Fuel::DEVELOPMENT
* Fuel::TEST
* Fuel::STAGING
* Fuel::PRODUCTION
*/
\Fuel::$env = isset($_SERVER['FUEL_ENV']) ? $_SERVER['FUEL_ENV'] : \Fuel::DEVELOPMENT;
// Initialize the framework with the config file.
\Fuel::init('config.php');
示例3:
<?php
/**
* LitePress
* Copyright (C) 2011 Nirix
*
* @author Nirix <nrx@nirix.net>
* @copyright LitePress Team
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU GPL v3-only
*
* @since 0.1
* @package LitePress
* @subpackage Config
*/
/**
* Your environment. Can be set to any of the following:
*
* Fuel::DEVELOPMENT
* Fuel::TEST
* Fuel::STAGE
* Fuel::PRODUCTION
*/
Fuel::$env = Fuel::PRODUCTION;
示例4: isset
// Load original setting file.
require APPPATH . 'config.inc.php';
// Bootstrap the framework DO NOT edit this
require COREPATH . 'bootstrap.php';
\Autoloader::add_classes(array('Controller' => APPPATH . 'classes/controller.php', 'Database_Query_Builder_Update' => APPPATH . 'classes/database/query/builder/update.php', 'DBUtil' => APPPATH . 'classes/dbutil.php', 'Uri' => APPPATH . 'classes/uri.php', 'Str' => APPPATH . 'classes/str.php', 'Html' => APPPATH . 'classes/html.php', 'Validation' => APPPATH . 'classes/validation.php', 'Agent' => APPPATH . 'classes/agent.php', 'Asset' => APPPATH . 'classes/asset.php', 'Asset_Instance' => APPPATH . 'classes/asset/instance.php', 'Fieldset' => APPPATH . 'classes/fieldset.php', 'Fieldset_Field' => APPPATH . 'classes/fieldset/field.php'));
// Register the autoloader
\Autoloader::register();
/**
* Your environment. Can be set to any of the following:
*
* Fuel::DEVELOPMENT
* Fuel::TEST
* Fuel::STAGING
* Fuel::PRODUCTION
*/
\Fuel::$env = isset($_SERVER['FUEL_ENV']) ? $_SERVER['FUEL_ENV'] : strtolower(FBD_ENVIRONMENT);
// include helpers.
Util_toolkit::include_php_files(APPPATH . 'helpers');
// Initialize the framework with the config file.
\Fuel::init('config.php');
// Config load.
Config::load('site', 'site');
Config::load('term', 'term');
Config::load('icon', 'icon');
Config::load('page', 'page');
Config::load('template', 'template');
Config::load('exif', 'exif');
Config::load('less', 'less');
// Config of each module load.
$modules = Site_Util::get_active_modules();
foreach ($modules as $module => $path) {
示例5: trim
// Load the PUPUnit Autoloader
include_once 'PHPUnit/Autoload.php';
/**
* Set error reporting and display errors settings. You will want to change these when in production.
*/
error_reporting(E_ALL);
ini_set('display_errors', 1);
$app_path = trim($_SERVER['app_path'], '/') . '/';
$package_path = trim($_SERVER['package_path'], '/') . '/';
$core_path = trim($_SERVER['core_path'], '/') . '/';
/**
* Website docroot
*/
define('DOCROOT', realpath(__DIR__ . DIRECTORY_SEPARATOR . $_SERVER['doc_root']) . 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);
unset($app_path, $core_path, $package_path, $_SERVER['app_path'], $_SERVER['core_path'], $_SERVER['package_path']);
// 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';
// Set the environment to TEST
Fuel::$env = Fuel::TEST;
Fuel::$is_test = true;
// Import the TestCase class
import('testcase');
示例6: isset
<?php
// Load in the Autoloader
require COREPATH . 'classes' . DIRECTORY_SEPARATOR . 'autoloader.php';
class_alias('Fuel\\Core\\Autoloader', 'Autoloader');
// Bootstrap the framework DO NOT edit this
require COREPATH . 'bootstrap.php';
Autoloader::add_classes(array('Basecontroller' => APPPATH . 'classes/lib/basecontroller.php', 'Basecontroller_Rest' => APPPATH . 'classes/lib/basecontroller_rest.php', 'ExValidation' => APPPATH . 'classes/lib/exvalidation.php', 'Fuel\\Core\\Exfieldset' => APPPATH . 'classes/lib/extends/fieldset.php', 'Model_Crud_Shard' => APPPATH . 'classes/lib/extends/model_crud_shard.php', 'Model_Crud_Shard_Payment' => APPPATH . 'classes/lib/extends/model_crud_shard_payment.php', 'Model_Crud_Master' => APPPATH . 'classes/lib/extends/model_crud_master.php', 'Model_Readonly' => APPPATH . 'classes/lib/extends/model_readonly.php', 'Agent' => APPPATH . 'classes/lib/extends/agent.php', 'Jpayment' => APPPATH . 'classes/lib/jpayment.php', 'Support\\File_Upload' => APPPATH . 'classes/lib/support/file_upload.php', 'Abstract_Saleitem' => APPPATH . 'classes/lib/saleitem/abstract_saleitem.php', 'Saleitem1' => APPPATH . 'classes/lib/saleitem/saleitem1.php', 'Saleitem2' => APPPATH . 'classes/lib/saleitem/saleitem2.php', 'Saleitem3' => APPPATH . 'classes/lib/saleitem/saleitem3.php', 'Saleitem4' => APPPATH . 'classes/lib/saleitem/saleitem4.php', 'Shop' => APPPATH . 'classes/lib/support/shop.php', 'Notification' => APPPATH . 'classes/lib/support/notification.php', 'Inspect' => APPPATH . 'classes/lib/support/inspect.php', 'Support\\Payment' => APPPATH . 'classes/lib/support/payment.php', 'Support\\Shard' => APPPATH . 'classes/lib/support/shard.php', 'Saleitem' => APPPATH . 'classes/lib/support/saleitem.php', 'RegistFees' => APPPATH . 'classes/lib/support/agent/regist_fees.php', 'Seminar' => APPPATH . 'classes/lib/support/seminar.php', 'Support\\Api\\Base' => APPPATH . 'classes/lib/support/api/base.php', 'Support\\Api\\Top' => APPPATH . 'classes/lib/support/api/top.php', 'Support\\Api\\Menu' => APPPATH . 'classes/lib/support/api/menu.php', 'Support\\Api\\Menu_Item' => APPPATH . 'classes/lib/support/api/menu_item.php', 'Support\\Api\\Coupon' => APPPATH . 'classes/lib/support/api/coupon.php', 'Support\\Api\\News' => APPPATH . 'classes/lib/support/api/news.php', 'Support\\Api\\Setting' => APPPATH . 'classes/lib/support/api/setting.php', 'Support\\Api\\Global_Info' => APPPATH . 'classes/lib/support/api/global_info.php', 'Support\\Inspect\\Base' => APPPATH . 'classes/lib/support/inspect/base.php', 'Support\\Inspect\\Top' => APPPATH . 'classes/lib/support/inspect/top.php', 'Support\\Inspect\\Coupon' => APPPATH . 'classes/lib/support/inspect/coupon.php', 'Support\\Inspect\\Menu' => APPPATH . 'classes/lib/support/inspect/menu.php'));
// Register the autoloader
Autoloader::register();
/**
* Your environment. Can be set to any of the following:
*
* Fuel::DEVELOPMENT
* Fuel::TEST
* Fuel::STAGING
* Fuel::PRODUCTION
*/
Fuel::$env = isset($_SERVER['FUEL_ENV']) ? $_SERVER['FUEL_ENV'] : Fuel::PRODUCTION;
// Initialize the framework with the config file.
Fuel::init('config.php');
示例7: isset
<?php
// Load in the Autoloader
require COREPATH . 'classes' . DIRECTORY_SEPARATOR . 'autoloader.php';
class_alias('Fuel\\Core\\Autoloader', 'Autoloader');
// Bootstrap the framework DO NOT edit this
require COREPATH . 'bootstrap.php';
Autoloader::add_classes(array());
// Register the autoloader
Autoloader::register();
/**
* Your environment. Can be set to any of the following:
*
* Fuel::DEVELOPMENT
* Fuel::TEST
* Fuel::STAGING
* Fuel::PRODUCTION
*/
// Fuel::$env = (isset($_SERVER['FUEL_ENV']) ? $_SERVER['FUEL_ENV'] : Fuel::DEVELOPMENT);
Fuel::$env = isset($_SERVER['HTTP_HOST']) && $_SERVER['HTTP_HOST'] == 'localhost' ? Fuel::DEVELOPMENT : Fuel::PRODUCTION;
// Initialize the framework with the config file.
Fuel::init('config.php');
示例8:
<?php
// Bootstrap the framework DO NOT edit this
require COREPATH . 'bootstrap.php';
\Autoloader::add_classes(array());
// Register the autoloader
\Autoloader::register();
/**
* Your environment. Can be set to any of the following:
*
* Fuel::DEVELOPMENT
* Fuel::TEST
* Fuel::STAGING
* Fuel::PRODUCTION
*/
//\Fuel::$env = (isset($_SERVER['FUEL_ENV']) ? $_SERVER['FUEL_ENV'] : \Fuel::DEVELOPMENT);
\Fuel::$env = Fuel::DEVELOPMENT;
// Initialize the framework with the config file.
\Fuel::init('config.php');
示例9:
<?php
// Bootstrap the framework DO NOT edit this
require COREPATH . 'bootstrap.php';
\Autoloader::add_classes(array());
// Register the autoloader
\Autoloader::register();
/**
* Your environment. Can be set to any of the following:
*
* Fuel::DEVELOPMENT
* Fuel::TEST
* Fuel::STAGING
* Fuel::PRODUCTION
*/
\Fuel::$env = \Arr::get($_SERVER, 'FUEL_ENV', \Arr::get($_ENV, 'FUEL_ENV', \Fuel::DEVELOPMENT));
// Initialize the framework with the config file.
\Fuel::init('config.php');
示例10: isset
<?php
// Bootstrap the framework DO NOT edit this
require COREPATH . 'bootstrap.php';
Autoloader::add_classes(array('Presenter' => APPPATH . 'classes/presenter.php', 'Controller' => APPPATH . 'classes/controller.php', 'Log' => APPPATH . 'classes/log.php', 'HttpNotFoundException' => APPPATH . 'classes/httpexceptions.php', 'HttpServerErrorException' => APPPATH . 'classes/httpexceptions.php', 'HttpBadRequestException' => APPPATH . 'classes/httpexceptions.php'));
// Register the autoloader
Autoloader::register();
/**
* Your environment. Can be set to any of the following:
*
* Fuel::DEVELOPMENT
* Fuel::TEST
* Fuel::STAGING
* Fuel::PRODUCTION
*/
Fuel::$env = isset($_SERVER['FUEL_ENV']) ? $_SERVER['FUEL_ENV'] : 'private';
// Initialize the framework with the config file.
Fuel::init('config.php');
// Make the debugger show all tree items expanded and up to the specified recursion level.
Debug::$js_toggle_open = true;
Debug::$max_nesting_level = 10;
// Default is 5
// Set the timezone to the default display timezone. Customers may change this later.
\Date::display_timezone('America/New_York');
// Rotate the session.
\Session::rotate();
// Unique user ID for the current page load (Used by \Monolog\Processor\BitAPIHubProcessor)
\Utility::unique_user();
// Set the language
\Environment::set_language();
示例11: init
public static function init($args)
{
//set up the environment
if ($env = \Cli::option('env')) {
\Fuel::$env = constant('\\Fuel::' . strtoupper($env)) ?: \Fuel::DEVELOPMENT;
}
// Remove flag options from the main argument list
$args = self::_clear_args($args);
try {
if (!isset($args[1])) {
if (\Cli::option('v', \Cli::option('version'))) {
\Cli::write('Fuel: ' . \Fuel::VERSION);
return;
}
static::help();
return;
}
switch ($args[1]) {
case 'g':
case 'generate':
$action = isset($args[2]) ? $args[2] : 'help';
$subfolder = 'orm';
if (is_int(strpos($action, '/'))) {
list($action, $subfolder) = explode('/', $action);
}
switch ($action) {
case 'config':
case 'controller':
case 'model':
case 'migration':
call_user_func('Oil\\Generate::' . $action, array_slice($args, 3));
break;
case 'views':
call_user_func('Oil\\Generate::views', array_slice($args, 3), $subfolder);
break;
case 'admin':
call_user_func('Oil\\Generate_Admin::forge', array_slice($args, 3), $subfolder);
break;
case 'scaffold':
call_user_func('Oil\\Generate_Scaffold::forge', array_slice($args, 3), $subfolder);
break;
default:
Generate::help();
}
break;
case 'c':
case 'console':
new Console();
case 'p':
case 'package':
$action = isset($args[2]) ? $args[2] : 'help';
switch ($action) {
case 'install':
case 'uninstall':
call_user_func_array('Oil\\Package::' . $action, array_slice($args, 3));
break;
default:
Package::help();
}
break;
case 'r':
case 'refine':
// Developers of third-party tasks may not be displaying PHP errors. Report any error and quit
set_error_handler(function ($errno, $errstr, $errfile, $errline) {
if (!error_reporting()) {
return;
}
// If the error was supressed with an @ then we ignore it!
\Cli::error("Error: {$errstr} in {$errfile} on {$errline}");
\Cli::beep();
exit;
});
$task = isset($args[2]) ? $args[2] : null;
call_user_func('Oil\\Refine::run', $task, array_slice($args, 3));
break;
case 'cell':
case 'cells':
$action = isset($args[2]) ? $args[2] : 'help';
switch ($action) {
case 'list':
call_user_func('Oil\\Cell::all');
break;
case 'search':
case 'install':
case 'upgrade':
case 'uninstall':
call_user_func_array('Oil\\Cell::' . $action, array_slice($args, 3));
break;
case 'info':
case 'details':
call_user_func_array('Oil\\Cell::info', array_slice($args, 3));
break;
default:
Cell::help();
}
break;
case 't':
case 'test':
// Suppressing this because if the file does not exist... well thats a bad thing and we can't really check
// I know that supressing errors is bad, but if you're going to complain: shut up. - Phil
//.........这里部分代码省略.........