本文整理汇总了PHP中Kohana::init方法的典型用法代码示例。如果您正苦于以下问题:PHP Kohana::init方法的具体用法?PHP Kohana::init怎么用?PHP Kohana::init使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Kohana
的用法示例。
在下文中一共展示了Kohana::init方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1:
*/
i18n::$lang = 'sv-se';
/**
* Initialize Kohana, setting the default options.
*
* The following options are available:
*
* - string base_url path, and optionally domain, of your application NULL
* - string index_file name of your index file, usually "index.php" index.php
* - string charset internal character set used for input and output utf-8
* - string cache_dir set the internal cache directory APPPATH/cache
* - boolean errors enable or disable error handling TRUE
* - boolean profile enable or disable internal profiling TRUE
* - boolean caching enable or disable internal caching FALSE
*/
Kohana::init(array('base_url' => '/', 'index_file' => '', 'profiling' => IN_DEVELOPMENT, 'caching' => !IN_DEVELOPMENT));
/**
* Attach the file write to logging. Multiple writers are supported.
*/
Kohana::$log->attach(new Log_File(APPPATH . 'logs'));
/**
* Attach a file reader to config. Multiple readers are supported.
*/
Kohana::$config->attach(new Kohana_Config_File());
/**
* Enable modules. Modules are referenced by a relative or absolute path.
*/
Kohana::modules(array('database' => MODPATH . 'database', 'sprig' => MODPATH . 'sprig', 'sprig-auth' => MODPATH . 'sprig-auth', 'auth' => MODPATH . 'auth', 'userguide' => MODPATH . 'userguide', 'koxtend' => MODPATH . 'koxtend', 'kotwig' => MODPATH . 'kotwig', 'e-mail' => MODPATH . 'kohana-email'));
// Attach verbose writer
Kohana::$log->attach(new Log_File_Exception(APPPATH . 'logs'), (array) Kohana::ERROR);
/**
示例2:
/**
* Initialize Kohana, setting the default options.
*
* The following options are available:
*
* - string base_url path, and optionally domain, of your application NULL
* - string index_file name of your index file, usually "index.php" index.php
* - string charset internal character set used for input and output utf-8
* - string cache_dir set the internal cache directory APPPATH/cache
* - integer cache_life lifetime, in seconds, of items cached 60
* - boolean errors enable or disable error handling TRUE
* - boolean profile enable or disable internal profiling TRUE
* - boolean caching enable or disable internal caching FALSE
* - boolean expose set the X-Powered-By header FALSE
*/
Kohana::init(array('base_url' => '/kohana/'));
/**
* Attach the file write to logging. Multiple writers are supported.
*/
Kohana::$log->attach(new Log_File(APPPATH . 'logs'));
/**
* Attach a file reader to config. Multiple readers are supported.
*/
Kohana::$config->attach(new Config_File());
Cookie::$salt = 'vFkdZeP74127asfNT';
// Please don't change this option at the work site
Cookie::$expiration = 1209600;
// 1209600 - 2 weeks
/**
* Enable modules. Modules are referenced by a relative or absolute path.
*/
示例3:
}
/**
* Initialize Kohana, setting the default options.
*
* The following options are available:
*
* - string base_url path, and optionally domain, of your application NULL
* - string index_file name of your index file, usually "index.php" index.php
* - string charset internal character set used for input and output utf-8
* - string cache_dir set the internal cache directory APPPATH/cache
* - boolean errors enable or disable error handling TRUE
* - boolean profile enable or disable internal profiling TRUE
* - boolean caching enable or disable internal caching FALSE
* - boolean autolocale enable or disable autodetect locale TRUE
*/
Kohana::init(array('base_url' => '/', 'index_file' => FALSE, 'caching' => Kohana::$environment === Kohana::PRODUCTION, 'profile' => Kohana::$environment !== Kohana::PRODUCTION));
/**
* Attach a file reader to config. Multiple readers are supported.
*/
Kohana::$config->attach(new Config_File());
/**
* Enable modules.
*
* Modules are referenced by a relative or absolute path.
*/
Kohana::modules(array('user' => MODPATH . 'user', 'database' => MODPATH . 'database', 'image' => MODPATH . 'image', 'captcha' => MODPATH . 'captcha', 'minion' => MODPATH . 'minion'));
/**
* Attach the file write to logging.
* Multiple writers are supported.
*/
if (Kohana::$environment !== Kohana::DEVELOPMENT and Kohana::$environment !== Kohana::STAGING) {
示例4: array
* - string charset internal character set used for input and output utf-8
* - string cache_dir set the internal cache directory APPPATH/cache
* - integer cache_life lifetime, in seconds, of items cached 60
* - boolean errors enable or disable error handling TRUE
* - boolean profile enable or disable internal profiling TRUE
* - boolean caching enable or disable internal caching FALSE
* - boolean expose set the X-Powered-By header FALSE
*/
if (in_array(@$_SERVER['SERVER_NAME'], array('127.0.0.1', 'fe80::1', '::1', 'localhost', '192.168.2.164', '192.168.0.123'))) {
$init = array('base_url' => "/tizzy", 'index_file' => "index.php", 'errors' => TRUE, 'profile' => Kohana::$environment === Kohana::DEVELOPMENT);
Kohana::$environment = Kohana::DEVELOPMENT;
} else {
$init = array('base_url' => "/", 'index_file' => FALSE, 'errors' => TRUE, 'profile' => Kohana::$environment === Kohana::PRODUCTION);
Kohana::$environment = Kohana::PRODUCTION;
}
Kohana::init($init);
/**
* Setting Cookie::$salt
*/
Cookie::$salt = '29961408e9a1bbbf0456dd913a12d31fffa587cc';
/**
* Attach the file write to logging. Multiple writers are supported.
*/
Kohana::$log->attach(new Log_File(APPPATH . 'logs'));
/**
* Attach a file reader to config. Multiple readers are supported.
*/
Kohana::$config->attach(new Config_File());
/**
* Enable modules. Modules are referenced by a relative or absolute path.
*/
示例5:
Kohana::$environment = $_ENV['KOHANA_ENV'];
}
/**
* Initialize Kohana, setting the default options.
*
* The following options are available:
*
* - string base_url path, and optionally domain, of your application NULL
* - string index_file name of your index file, usually "index.php" index.php
* - string charset internal character set used for input and output utf-8
* - string cache_dir set the internal cache directory APPPATH/cache
* - boolean errors enable or disable error handling TRUE
* - boolean profile enable or disable internal profiling TRUE
* - boolean caching enable or disable internal caching FALSE
*/
Kohana::init(array('base_url' => '/', 'index_file' => FALSE, 'errors' => FALSE));
/**
* Attach the file write to logging. Multiple writers are supported.
*/
Kohana::$log->attach(new Kohana_Log_File(APPPATH . 'logs'));
/**
* Attach a file reader to config. Multiple readers are supported.
*/
Kohana::$config->attach(new Kohana_Config_File());
/**
* Enable modules. Modules are referenced by a relative or absolute path.
*/
Kohana::modules(array('api' => MODPATH . 'api', 'auth' => MODPATH . 'auth', 'cache' => MODPATH . 'cache', 'censor' => MODPATH . 'censor', 'database' => MODPATH . 'database', 'email' => MODPATH . 'email', 'error' => MODPATH . 'error', 'ftp' => MODPATH . 'ftp', 'googlechart' => MODPATH . 'googlechart', 'image' => MODPATH . 'image', 'key' => MODPATH . 'key', 'message' => MODPATH . 'message', 'orm' => MODPATH . 'orm', 'pagination' => MODPATH . 'pagination', 'reel' => MODPATH . 'reel', 'widget' => MODPATH . 'widget'));
/**
* Set the routes. Each route must have a minimum of a name, a URI and a set of
* defaults for the URI.
示例6: array
}
}
/**
* Initialize Kohana, setting the default options.
*
* The following options are available:
*
* - string base_url path, and optionally domain, of your application NULL
* - string index_file name of your index file, usually "index.php" index.php
* - string charset internal character set used for input and output utf-8
* - string cache_dir set the internal cache directory APPPATH/cache
* - boolean errors enable or disable error handling TRUE
* - boolean profile enable or disable internal profiling TRUE
* - boolean caching enable or disable internal caching FALSE
*/
Kohana::init(array('base_url' => '/', 'errors' => TRUE, 'profile' => Kohana::$environment === Kohana::DEVELOPMENT, 'caching' => Kohana::$environment === Kohana::PRODUCTION));
/**
* Define error levels = array of messages levels to write OR max level to write
*/
//Kohana::$log->attach(new Log_File(APPPATH.'logs'));
if (Kohana::$environment !== Kohana::DEVELOPMENT and Kohana::$environment !== Kohana::STAGING) {
//$LEVELS = array();
$LEVELS = array(LOG_ERR);
} else {
$LEVELS = array(LOG_INFO, LOG_ERR, LOG_DEBUG);
}
/**
* Attach the file write to logging. Multiple writers are supported.
*/
Kohana::$log->attach(new Log_File(APPPATH . 'logs'), $LEVELS);
/**
示例7: defined
<?php
defined('SYSPATH') or die('No direct script access.');
require "functions.php";
require SYSPATH . 'classes/Kohana/Core' . EXT;
if (is_file(APPPATH . 'classes/Kohana' . EXT)) {
require APPPATH . 'classes/Kohana' . EXT;
} else {
require SYSPATH . 'classes/Kohana' . EXT;
}
date_default_timezone_set('Europe/Moscow');
setlocale(LC_ALL, 'en_US.utf-8');
spl_autoload_register(['Kohana', 'auto_load']);
ini_set('unserialize_callback_func', 'spl_autoload_call');
mb_substitute_character('none');
I18n::lang('en-us');
if (isset($_SERVER['SERVER_PROTOCOL'])) {
HTTP::$protocol = $_SERVER['SERVER_PROTOCOL'];
}
Kohana::$environment = Kohana::PRODUCTION;
Kohana::init(['base_url' => '/', 'index_file' => false, 'errors' => true]);
$composerAutoload = COMPOSERPATH . 'vendor/autoload.php';
require_once "{$composerAutoload}";
\Zver\FileCache::setDirectory(APPPATH . 'cache' . DIRECTORY_SEPARATOR);
Kohana::$log->attach(new Log_File(APPPATH . 'logs'));
Kohana::$config->attach(new Config_File());
Kohana::modules(['auth' => MODPATH . 'auth', 'database' => MODPATH . 'database', 'image' => MODPATH . 'image', 'orm' => MODPATH . 'orm', 'admin' => MODPATH . 'admin', 'yandexmap' => MODPATH . 'yandexmap', 'minion' => MODPATH . 'minion', 'captcha' => MODPATH . 'captcha', 'pagination' => MODPATH . 'pagination']);
include_once 'routes.php';
示例8: ini_set
ini_set('unserialize_callback_func', 'spl_autoload_call');
//-- Configuration and initialization -----------------------------------------
/**
* Initialize Kohana, setting the default options.
*
* The following options are available:
*
* - string base_url path, and optionally domain, of your application NULL
* - string index_file name of your index file, usually "index.php" index.php
* - string charset internal character set used for input and output utf-8
* - string cache_dir set the internal cache directory APPPATH/cache
* - boolean errors enable or disable error handling TRUE
* - boolean profile enable or disable internal profiling TRUE
* - boolean caching enable or disable internal caching FALSE
*/
Kohana::init(array('base_url' => '/web/'));
/**
* Attach the file write to logging. Multiple writers are supported.
*/
Kohana::$log->attach(new Kohana_Log_File(APPPATH . 'logs'));
/**
* Attach a file reader to config. Multiple readers are supported.
*/
Kohana::$config->attach(new Kohana_Config_File());
/**
* Enable modules. Modules are referenced by a relative or absolute path.
*/
Kohana::modules(array('swiftriverapihook' => MODPATH . 'swiftriverlocalapihook', 'riverid' => MODPATH . 'riverid', 'swiftrivertheming' => MODPATH . 'swiftrivertheming'));
/**
* Set the routes. Each route must have a minimum of a name, a URI and a set of
* defaults for the URI.
示例9: substr
/**
* Initialize Kohana, setting the default options.
*
* The following options are available:
*
* - string base_url path, and optionally domain, of your application NULL
* - string index_file name of your index file, usually "index.php" index.php
* - string charset internal character set used for input and output utf-8
* - string cache_dir set the internal cache directory APPPATH/cache
* - boolean errors enable or disable error handling TRUE
* - boolean profile enable or disable internal profiling TRUE
* - boolean caching enable or disable internal caching FALSE
*/
//this is a convention that eases things for us, but doesn't break interoperability of the mop modules
$path = substr($_SERVER['SCRIPT_NAME'], 0, -9);
Kohana::init(array('base_url' => $path));
/**
* Attach the file write to logging. Multiple writers are supported.
*/
Kohana::$log->attach(new Log_File(APPPATH . 'logs'));
/**
* Attach a file reader to config. Multiple readers are supported.
*/
Kohana::$config->attach(new Config_File());
/**
* Enable modules. Modules are referenced by a relative or absolute path.
*/
Kohana::modules(array('lattice' => 'lattice/lattice', 'latticeauth' => 'lattice/latticeauth', 'latticecore' => 'lattice/latticecore', 'latticejs' => 'lattice/latticejs', 'latticeui' => 'lattice/latticeui', 'latticeextras' => 'lattice/latticeextras', 'testbed' => 'lattice/testbed', 'latticeviews' => 'lattice/latticeviews', 'navigation' => 'lattice/navigation', 'usermanagement' => 'lattice/usermanagement', 'latticeviews' => 'lattice/latticeviews', 'auth' => MODPATH . 'auth', 'database' => MODPATH . 'database', 'image' => MODPATH . 'image', 'orm' => MODPATH . 'orm'));
//check for setup
Lattice_Initializer::check(array('rootgraph', 'lattice', 'cms', 'latticecms', 'latticeauth', 'latticetests', 'usermanagement', 'testing', 'defaultusers'));
/**
示例10:
/**
* Initialize Kohana, setting the default options.
*
* The following options are available:
*
* - string base_url path, and optionally domain, of your application NULL
* - string index_file name of your index file, usually "index.php" index.php
* - string charset internal character set used for input and output utf-8
* - string cache_dir set the internal cache directory APPPATH/cache
* - integer cache_life lifetime, in seconds, of items cached 60
* - boolean errors enable or disable error handling TRUE
* - boolean profile enable or disable internal profiling TRUE
* - boolean caching enable or disable internal caching FALSE
* - boolean expose set the X-Powered-By header FALSE
*/
Kohana::init(array('base_url' => 'http://localhost:4000/', 'index_file' => false));
/**
* Attach the file write to logging. Multiple writers are supported.
*/
Kohana::$log->attach(new Log_File(APPPATH . 'logs'));
/**
* Attach a file reader to config. Multiple readers are supported.
*/
Kohana::$config->attach(new Config_File());
/**
* Enable modules. Modules are referenced by a relative or absolute path.
*/
Kohana::modules(array('auth' => MODPATH . 'auth', 'database' => MODPATH . 'database', 'orm' => MODPATH . 'orm'));
/**
* Cookie Salt
* @see http://kohanaframework.org/3.3/guide/kohana/cookies
示例11: ini_set
ini_set('unserialize_callback_func', 'spl_autoload_call');
//-- Configuration and initialization -----------------------------------------
/**
* Initialize Kohana, setting the default options.
*
* The following options are available:
*
* - string base_url path, and optionally domain, of your application NULL
* - string index_file name of your index file, usually "index.php" index.php
* - string charset internal character set used for input and output utf-8
* - string cache_dir set the internal cache directory APPPATH/cache
* - boolean errors enable or disable error handling TRUE
* - boolean profile enable or disable internal profiling TRUE
* - boolean caching enable or disable internal caching FALSE
*/
Kohana::init(array('base_url' => BASE_URL, 'index_file' => INDEX_FILE, 'errors' => !IN_PRODUCTION, 'profile' => !IN_PRODUCTION, 'caching' => IN_PRODUCTION));
/**
* Attach the file write to logging. Multiple writers are supported.
*/
$log_levels = preg_split("/,/", LOG_LVL);
Kohana::$log->attach(new Kohana_Log_File(APPPATH . 'site_logs'), $log_levels);
Kohana::$log->attach(new Kohana_Log_File(APPPATH . 'access_logs'), array('ACCESS'));
/**
* Attach a file reader to config. Multiple readers are supported.
* Attach a file reader to profile-specific config directory.
*/
Kohana::$config->attach(new Kohana_Config_File());
Kohana::$config->attach(new Kohana_Config_File(CONF_DIR), TRUE);
/**
* Enable modules. Modules are referenced by a relative or absolute path.
*/
示例12:
Kohana::$environment = $_ENV['KOHANA_ENV'];
}
/**
* Initialize Kohana, setting the default options.
*
* The following options are available:
*
* - string base_url path, and optionally domain, of your application NULL
* - string index_file name of your index file, usually "index.php" index.php
* - string charset internal character set used for input and output utf-8
* - string cache_dir set the internal cache directory APPPATH/cache
* - boolean errors enable or disable error handling TRUE
* - boolean profile enable or disable internal profiling TRUE
* - boolean caching enable or disable internal caching FALSE
*/
Kohana::init(array('base_url' => '/library/', 'index_file' => '', 'caching' => TRUE));
/**
* Attach the file write to logging. Multiple writers are supported.
*/
Kohana::$log->attach(new Kohana_Log_File(APPPATH . 'logs'));
/**
* Attach a file reader to config. Multiple readers are supported.
*/
Kohana::$config->attach(new Kohana_Config_File());
/**
* Enable modules. Modules are referenced by a relative or absolute path.
*/
Kohana::modules(array('cache' => MODPATH . 'cache', 'database' => MODPATH . 'database', 'orm' => MODPATH . 'orm'));
/**
* Set the routes. Each route must have a minimum of a name, a URI and a set of
* defaults for the URI.
示例13: constant
Kohana::$environment = constant('Kohana::' . strtoupper($_SERVER['KOHANA_ENV']));
}
/**
* Initialize Kohana, setting the default options.
*
* The following options are available:
*
* - string base_url path, and optionally domain, of your application NULL
* - string index_file name of your index file, usually "index.php" index.php
* - string charset internal character set used for input and output utf-8
* - string cache_dir set the internal cache directory APPPATH/cache
* - boolean errors enable or disable error handling TRUE
* - boolean profile enable or disable internal profiling TRUE
* - boolean caching enable or disable internal caching FALSE
*/
Kohana::init(array('base_url' => 'http://kodelearn.kp/', 'index.php' => ''));
/**
* Attach the file write to logging. Multiple writers are supported.
*/
Kohana::$log->attach(new Log_File(APPPATH . 'logs'));
/**
* Attach a file reader to config. Multiple readers are supported.
*/
Kohana::$config->attach(new Config_File());
/**
* Enable modules. Modules are referenced by a relative or absolute path.
*/
Kohana::modules(array('auth' => MODPATH . 'auth', 'database' => MODPATH . 'database', 'image' => MODPATH . 'image', 'orm' => MODPATH . 'orm', 'unittest' => MODPATH . 'unittest', 'stickyform' => MODPATH . 'stickyform', 'breadcrumbs' => MODPATH . 'breadcrumbs', 'playground' => MODPATH . 'playground', 'sort' => MODPATH . 'sort', 'dynamicmenu' => MODPATH . 'dynamicmenu', 'pagination' => MODPATH . 'pagination', 'cacheimage' => MODPATH . 'cacheimage', 'purifier' => MODPATH . 'purifier', 'eventdispatch' => MODPATH . 'eventdispatch', 'email' => MODPATH . 'email', 'notice' => MODPATH . 'notice', 'exam' => MODPATH . 'exam', 'event' => MODPATH . 'event', 'calendar' => MODPATH . 'calendar', 'lecture' => MODPATH . 'lecture', 'attendance' => MODPATH . 'attendance', 'feed' => MODPATH . 'feed', 'post' => MODPATH . 'post', 'document' => MODPATH . 'document', 'assignment' => MODPATH . 'assignment', 'exercise' => MODPATH . 'exercise', 'lesson' => MODPATH . 'lesson', 'flashcard' => MODPATH . 'flashcard', 'question' => MODPATH . 'question', 'link' => MODPATH . 'link', 'video' => MODPATH . 'video'));
/**
* Set the routes. Each route must have a minimum of a name, a URI and a set of
* defaults for the URI.
示例14: ini_set
ini_set('unserialize_callback_func', 'spl_autoload_call');
//-- Configuration and initialization -----------------------------------------
/**
* Initialize Kohana, setting the default options.
*
* The following options are available:
*
* - string base_url path, and optionally domain, of your application NULL
* - string index_file name of your index file, usually "index.php" index.php
* - string charset internal character set used for input and output utf-8
* - string cache_dir set the internal cache directory APPPATH/cache
* - boolean errors enable or disable error handling TRUE
* - boolean profile enable or disable internal profiling TRUE
* - boolean caching enable or disable internal caching FALSE
*/
Kohana::init(array('base_url' => WEB_ROOT, 'index_file' => false, 'profile' => !IN_PRODUCTION, 'caching' => IN_PRODUCTION));
/**
* Attach the file write to logging. Multiple writers are supported.
*/
Kohana::$log->attach(new Kohana_Log_File(APPPATH . 'logs'));
/**
* Attach a file reader to config. Multiple readers are supported.
*/
Kohana::$config->attach(new Kohana_Config_File());
/**
* Enable modules. Modules are referenced by a relative or absolute path.
*/
Kohana::modules(array('auth' => MODPATH . 'auth', 'database' => MODPATH . 'database', 'orm' => MODPATH . 'orm', 'pagination' => MODPATH . 'pagination', 'migrations' => MODPATH . 'migrations', 'message' => MODPATH . 'message'));
# Shortcuts for user actions
Route::set('login', 'login')->defaults(array('controller' => 'user', 'action' => 'login'));
Route::set('logout', 'logout')->defaults(array('controller' => 'user', 'action' => 'logout'));
示例15: define
* @see http://docs.kohanaphp.com/bootstrap
*
* ----------------------------------------------------------------------------
*/
// Define the name of the front controller index
define('FCINDEX', basename(__FILE__));
// Define the absolute paths for configured directories
define('DOCROOT', str_replace('\\', '/', realpath(getcwd())) . '/');
define('APPPATH', str_replace('\\', '/', realpath($application)) . '/');
define('MODPATH', str_replace('\\', '/', realpath($modules)) . '/');
define('SYSPATH', str_replace('\\', '/', realpath($system)) . '/');
// Clean up the configuration vars
unset($application, $modules, $system);
if (file_exists('install' . EXT)) {
// Load the installation check
return include 'install' . EXT;
}
// Load the main Kohana class
require SYSPATH . 'classes/kohana' . EXT;
// Enable auto-loading of classes
spl_autoload_register(array('Kohana', 'auto_load'));
// Enable the exception handler
// set_exception_handler(array('Kohana', 'exception_handler'));
// Enable the error-to-exception handler
set_error_handler(array('Kohana', 'error_handler'));
// Initialize the environment
Kohana::init();
// Create the main instance
Kohana::instance();
// Shutdown the environment
Kohana::shutdown();