本文整理匯總了PHP中Configure::Load方法的典型用法代碼示例。如果您正苦於以下問題:PHP Configure::Load方法的具體用法?PHP Configure::Load怎麽用?PHP Configure::Load使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Configure
的用法示例。
在下文中一共展示了Configure::Load方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: finish
/**
* Step 4: finish
*
* @return void
* @access public
*/
function finish()
{
$this->set('title_for_layout', __('Installation completed successfully', true));
$this->_check();
// set email address for admin
Configure::Load('install');
$User = ClassRegistry::init('User');
$User->id = $User->field('id', array('user_name' => 'admin'));
$User->saveField('email', 'admin@' . Configure::read('urls.domain'));
// set new salt and seed value
$File =& new File(CONFIGS . 'core.php');
if (!class_exists('Security')) {
require LIBS . 'security.php';
}
$salt = Security::generateAuthKey();
$seed = mt_rand() . mt_rand();
$contents = $File->read();
$contents = preg_replace('/(?<=Configure::write\\(\'Security.salt\', \')([^\' ]+)(?=\'\\))/', $salt, $contents);
$contents = preg_replace('/(?<=Configure::write\\(\'Security.cipherSeed\', \')(\\d+)(?=\'\\))/', $seed, $contents);
if (!$File->write($contents)) {
return false;
}
// set password, hashed according to new salt value
$User->saveField('password', Security::hash('password', 'sha256', $salt));
$this->_writeInstalled();
}
示例2:
*
* App::build(array(
* 'plugins' => array('/full/path/to/plugins/', '/next/full/path/to/plugins/'),
* 'models' => array('/full/path/to/models/', '/next/full/path/to/models/'),
* 'views' => array('/full/path/to/views/', '/next/full/path/to/views/'),
* 'controllers' => array('/full/path/to/controllers/', '/next/full/path/to/controllers/'),
* 'datasources' => array('/full/path/to/datasources/', '/next/full/path/to/datasources/'),
* 'behaviors' => array('/full/path/to/behaviors/', '/next/full/path/to/behaviors/'),
* 'components' => array('/full/path/to/components/', '/next/full/path/to/components/'),
* 'helpers' => array('/full/path/to/helpers/', '/next/full/path/to/helpers/'),
* 'vendors' => array('/full/path/to/vendors/', '/next/full/path/to/vendors/'),
* 'shells' => array('/full/path/to/shells/', '/next/full/path/to/shells/'),
* 'locales' => array('/full/path/to/locale/', '/next/full/path/to/locale/')
* ));
*
*/
/**
* As of 1.3, additional rules for the inflector are added below
*
* Inflector::rules('singular', array('rules' => array(), 'irregular' => array(), 'uninflected' => array()));
* Inflector::rules('plural', array('rules' => array(), 'irregular' => array(), 'uninflected' => array()));
*
*/
/**
* Load any additional configuration files.
*/
require_once CONFIGS . 'version.php';
Configure::Load('install');
Configure::Load('features');
Configure::Load('options');
App::import('Lib', 'zuluru');
示例3: _setLanguage
function _setLanguage()
{
$this->_findLanguage();
$i18n =& I18n::getInstance();
$this->Session->write('Config.language', $i18n->l10n->lang);
Configure::write('Config.language', $i18n->l10n->lang);
Configure::write('Config.language_name', $i18n->l10n->language);
Configure::Load('features');
Configure::Load('options');
}