本文整理汇总了PHP中Environment::init方法的典型用法代码示例。如果您正苦于以下问题:PHP Environment::init方法的具体用法?PHP Environment::init怎么用?PHP Environment::init使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Environment
的用法示例。
在下文中一共展示了Environment::init方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: start
public static function start($buildOptions = array())
{
try {
$buildOptions['VERBOSE_MODE'] = array('', false);
Environment::init($buildOptions);
self::processArg();
} catch (\Exception $e) {
self::help($e->getMessage());
}
}
示例2: init
public static function init($aOptions)
{
parent::init($aOptions);
$options = static::getVars();
//url to the app package dir, i.e. /__
$path = preg_replace('/^' . preg_quote(realpath($_SERVER['DOCUMENT_ROOT']), '/') . '/', '', realpath($options->get('appPackageFilePath')));
$path = str_replace('\\', '/', $path);
$options->add('appPackageWebPath', $path);
//url to app dependencies dir, i.e. /__/deps
$options->add('appDependenciesWebPath', $options->get('appPackageWebPath') . '/deps');
//url to the app source dir
//NOTE: this defaults to the same as appPackageWebPath, but can be overridden at the app level if desired
//
//Possible use cases are:
//
//- if you want to use a 'src' dir as a sibling to the 'deps' dir, i.e. /__/src.
// Components would therefore be at /__/src/App/Controller.js
//
//- if you want to append a virtual dir for versioning/cache-busting purposes.
// e.g. /__/@v1.0/App/Controller.js
$options->add('appSourceWebPath', $options->get('appPackageWebPath'));
}
示例3: dirname
<?php
/**
* This is the bootstrap file for console application.
*/
// Set environment
require_once dirname(__FILE__) . '/protected/extensions/environment/Environment.php';
$env = new Environment();
$env->init();
Yii::createConsoleApplication($env->console)->run();
// When you execute a PHP script from the command line, it inherits the environment variables defined in your shell.
// That means you can set an environment variable using the export command like so:
// export YII_ENVIRONMENT='TEST'
// Shell: php /path/to/cron.php command
示例4: setUp
/**
* Sets up the fixture, for example, opens a network connection.
* This method is called before a test is executed.
*/
public function setUp()
{
Environment::init();
}
示例5: defined
* init.php
* -------------------
* begin : October 06, 2011
* copyright : (C) 2011 Kevin MASSY
* email : kevin.massy@phpboost.com
*
*
###################################################
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
###################################################*/
defined('PATH_TO_ROOT') or define('PATH_TO_ROOT', '..');
require_once PATH_TO_ROOT . '/kernel/framework/core/environment/Environment.class.php';
Environment::load_imports();
Environment::init();
/* DEPRECATED VARS */
$Bread_crumb = new BreadCrumb();
/* END DEPRECATED */
示例6: read
/**
* Read configuration key
*
* @param string $key Key name
* @param string $environment Environment name
* @return false|string false or value
*/
public static function read($key = '', $environment = '')
{
Environment::init();
if (empty($environment)) {
$environment = Environment::get();
}
$value = Configure::read('Environment.' . $environment . '.' . $key);
if ($value !== null) {
return $value;
}
return false;
}