本文整理汇总了PHP中Configure::store方法的典型用法代码示例。如果您正苦于以下问题:PHP Configure::store方法的具体用法?PHP Configure::store怎么用?PHP Configure::store使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Configure
的用法示例。
在下文中一共展示了Configure::store方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getPrivateId
function getPrivateId()
{
Configure::load('gitrbug');
$id_n = Configure::read('gitrbug.num_secrets');
Configure::load('gitrbug_secrets');
$id_s = Configure::read('gitrbug_s.secrets');
$id_a = unserialize(stripslashes($id_s));
if (count($id_a) < $id_n) {
App::Import('Model', 'Peer');
$peerModel =& ClassRegistry::init('Peer');
while (count($id_a) < $id_n) {
$id_a[] = $peerModel->_genUUID();
}
Configure::write('gitrbug_s.secrets', serialize($id_a));
Configure::store('gitrbug', 'gitrbug_secrets', Configure::read('gitrbug_s'));
}
$id_x = rand(0, $id_n - 1);
return $id_a[$id_x];
}
示例2: testStoreAndLoad
/**
* testStore method
*
* @access public
* @return void
*/
function testStoreAndLoad()
{
Configure::write('Cache.disable', false);
$expected = array('data' => 'value');
Configure::store('SomeExample', 'test', $expected);
Configure::load('test');
$config = Configure::read('SomeExample');
$this->assertEqual($config, $expected);
$expected = array('data' => array('first' => 'value', 'second' => 'value2'));
Configure::store('AnotherExample', 'test.config', $expected);
Configure::load('test.config');
$config = Configure::read('AnotherExample');
$this->assertEqual($config, $expected);
}
示例3: testStoreAndRestoreWithData
/**
* test that store and restore only store/restore the provided data.
*
* @return void
*/
public function testStoreAndRestoreWithData()
{
Configure::write('Cache.disable', false);
Configure::write('testing', 'value');
Configure::store('store_test', 'default', array('store_test' => 'one'));
Configure::delete('testing');
$this->assertNull(Configure::read('store_test'), 'Calling store with data shouldn\'t modify runtime.');
Configure::restore('store_test', 'default');
$this->assertEquals('one', Configure::read('store_test'));
$this->assertNull(Configure::read('testing'), 'Values that were not stored are not restored.');
Cache::delete('store_test', 'default');
}
示例4: testStoreAndLoad
/**
* testStore method
*
* @access public
* @return void
*/
function testStoreAndLoad() {
Configure::write('Cache.disable', false);
$expected = array('data' => 'value with backslash \, \'singlequote\' and "doublequotes"');
Configure::store('SomeExample', 'test', $expected);
Configure::load('test');
$config = Configure::read('SomeExample');
$this->assertEqual($config, $expected);
$expected = array(
'data' => array('first' => 'value with backslash \, \'singlequote\' and "doublequotes"', 'second' => 'value2'),
'data2' => 'value'
);
Configure::store('AnotherExample', 'test_config', $expected);
Configure::load('test_config');
$config = Configure::read('AnotherExample');
$this->assertEqual($config, $expected);
}
示例5: _writeTestConfiguration
protected function _writeTestConfiguration()
{
$name = 'test_authority';
$acl = array('editor' => array('articles' => array('publish', 'edit', 'delete')), 'administrator' => '*', 'csr' => array('orders', 'payments', 'users' => array('view', 'resend_password')));
Configure::store('ACL', $name, $acl);
}
示例6: define
}
if (!defined('SERVER_IIS') && php_sapi_name() == 'isapi') {
define('SERVER_IIS', true);
}
/**
* Configuration, directory layout and standard libraries
*/
if (!isset($bootstrap)) {
require CORE_PATH . 'cake' . DS . 'basics.php';
$TIME_START = getMicrotime();
require CORE_PATH . 'cake' . DS . 'config' . DS . 'paths.php';
require LIBS . 'object.php';
require LIBS . 'inflector.php';
require LIBS . 'configure.php';
}
require LIBS . 'cache.php';
Configure::getInstance();
if (Configure::read('Cache.disable') !== true) {
$cache = Cache::settings();
if (empty($cache)) {
trigger_error('Cache not configured. Please use Cache::config(); in APP/config/core.php', E_USER_WARNING);
Cache::config('default', array('engine' => 'File'));
}
}
require LIBS . 'session.php';
require LIBS . 'security.php';
require LIBS . 'string.php';
Configure::store(null, 'class.paths');
Configure::load('class.paths');
$url = null;
require CAKE . 'dispatcher.php';
示例7: loadComponent
/**
* Loads a component
*
* @param string $name Name of component
* @return boolean Success
*/
function loadComponent($name)
{
if ($name === null) {
return true;
}
if (strpos($name, '.') !== false) {
list($plugin, $name) = explode('.', $name);
}
$className = $name . 'Component';
if (!class_exists($className)) {
$name = Inflector::underscore($name);
$components = Configure::read('Components');
if (is_array($components)) {
if (array_key_exists($className, $components)) {
require $components[$className]['path'];
return true;
} elseif (isset($components['Core']) && array_key_exists($className, $components['Core'])) {
require $components['Core'][$className]['path'];
return true;
}
}
$paths = Configure::getInstance();
foreach ($paths->componentPaths as $path) {
if (file_exists($path . $name . '.php')) {
Configure::store('Components', 'class.paths', array($className => array('path' => $path . $name . '.php')));
require $path . $name . '.php';
return true;
}
}
if ($componentFilename = fileExistsInPath(LIBS . 'controller' . DS . 'components' . DS . $name . '.php')) {
if (file_exists($componentFilename)) {
Configure::store('Components\'][\'Core', 'class.paths', array($className => array('path' => $componentFilename)));
require $componentFilename;
return true;
} else {
return false;
}
}
}
return true;
}