本文整理汇总了PHP中Uri::detect方法的典型用法代码示例。如果您正苦于以下问题:PHP Uri::detect方法的具体用法?PHP Uri::detect怎么用?PHP Uri::detect使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Uri
的用法示例。
在下文中一共展示了Uri::detect方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: load
/**
* Store the page to class static vars
*
* @param
* @return
*/
public static function load()
{
$segments = explode('/', \Uri::detect(), 2);
$page = !empty($segments[0]) ? $segments[0] : 'home';
$parameters = !empty($segments[1]) ? $segments[1] : null;
$result = \DB::select('*')->from('pages')->where('page', $page)->where('status', true)->limit(1)->execute()->current();
if (!$result) {
static::$response_status = 404;
$result = \DB::select('*')->from('pages')->where('page', '404')->limit(1)->execute()->current();
}
static::$id = $result['id'];
static::$page = $page;
static::$parameters = $parameters;
static::$meta_title = $result['meta_title'];
static::$meta_keywords = $result['meta_keywords'];
static::$meta_description = $result['meta_description'];
static::$content = $result['content'];
static::$status = $result['status'];
}
示例2: init
/**
* Initializes the framework. This can only be called once.
*
* @access public
* @return void
*/
public static function init($config)
{
if (static::$initialized) {
throw new \Exception("You can't initialize Fuel more than once.");
}
register_shutdown_function('fuel_shutdown_handler');
set_exception_handler('fuel_exception_handler');
set_error_handler('fuel_error_handler');
// Start up output buffering
ob_start();
static::$profiling = isset($config['profiling']) ? $config['profiling'] : false;
if (static::$profiling) {
\Profiler::init();
\Profiler::mark(__METHOD__ . ' Start');
}
static::$cache_dir = isset($config['cache_dir']) ? $config['cache_dir'] : APPPATH . 'cache/';
static::$caching = isset($config['caching']) ? $config['caching'] : false;
static::$cache_lifetime = isset($config['cache_lifetime']) ? $config['cache_lifetime'] : 3600;
if (static::$caching) {
static::$path_cache = static::cache('Fuel::path_cache');
}
\Config::load($config);
static::$_paths = array_merge(\Config::get('module_paths', array()), array(APPPATH, COREPATH));
static::$is_cli = (bool) (php_sapi_name() == 'cli');
if (!static::$is_cli) {
if (\Config::get('base_url') === null) {
\Config::set('base_url', static::generate_base_url());
}
\Uri::detect();
}
// Run Input Filtering
\Security::clean_input();
static::$env = \Config::get('environment');
static::$locale = \Config::get('locale');
//Load in the packages
foreach (\Config::get('always_load.packages', array()) as $package) {
static::add_package($package);
}
// Set some server options
setlocale(LC_ALL, static::$locale);
// Always load classes, config & language set in always_load.php config
static::always_load();
static::$initialized = true;
if (static::$profiling) {
\Profiler::mark(__METHOD__ . ' End');
}
}
示例3: init
/**
* Initializes the framework. This can only be called once.
*
* @access public
* @return void
*/
public static function init($config)
{
\Config::load($config);
if (static::$initialized) {
throw new \Fuel_Exception("You can't initialize Fuel more than once.");
}
register_shutdown_function('fuel_shutdown_handler');
set_exception_handler('fuel_exception_handler');
set_error_handler('fuel_error_handler');
// Start up output buffering
ob_start(\Config::get('ob_callback', null));
static::$profiling = \Config::get('profiling', false);
if (static::$profiling) {
\Profiler::init();
\Profiler::mark(__METHOD__ . ' Start');
}
static::$cache_dir = \Config::get('cache_dir', APPPATH . 'cache/');
static::$caching = \Config::get('caching', false);
static::$cache_lifetime = \Config::get('cache_lifetime', 3600);
if (static::$caching) {
static::$path_cache = static::cache('Fuel::path_cache');
}
// set a default timezone if one is defined
static::$timezone = \Config::get('default_timezone') ?: date_default_timezone_get();
date_default_timezone_set(static::$timezone);
// set the encoding and locale to use
static::$encoding = \Config::get('encoding', static::$encoding);
static::$locale = \Config::get('locale', static::$locale);
static::$_paths = array(APPPATH, COREPATH);
if (!static::$is_cli) {
if (\Config::get('base_url') === null) {
\Config::set('base_url', static::generate_base_url());
}
\Uri::detect();
}
// Run Input Filtering
\Security::clean_input();
static::$env = \Config::get('environment');
\Event::register('shutdown', 'Fuel::finish');
//Load in the packages
foreach (\Config::get('always_load.packages', array()) as $package => $path) {
is_string($package) and $path = array($package => $path);
static::add_package($path);
}
// Load in the routes
\Config::load('routes', true);
\Router::add(\Config::get('routes'));
// Set locale
static::$locale and setlocale(LC_ALL, static::$locale);
// Always load classes, config & language set in always_load.php config
static::always_load();
static::$initialized = true;
if (static::$profiling) {
\Profiler::mark(__METHOD__ . ' End');
}
}