当前位置: 首页>>代码示例>>PHP>>正文


PHP Configure::config方法代码示例

本文整理汇总了PHP中Cake\Core\Configure::config方法的典型用法代码示例。如果您正苦于以下问题:PHP Configure::config方法的具体用法?PHP Configure::config怎么用?PHP Configure::config使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Cake\Core\Configure的用法示例。


在下文中一共展示了Configure::config方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: testStartupWithExistingConfigFile

 /**
  * Test StartupWithExistingConfigFile
  *
  * @return void
  */
 public function testStartupWithExistingConfigFile()
 {
     Configure::config('default', new PhpConfig(PATH_TO_CONFIG_FILES));
     Configure::load('recaptchaWithExistingKeys', 'default', false);
     // check that secret is well imported
     $this->assertEquals('goodsecret', Configure::read('Recaptcha.secret'));
 }
开发者ID:cake17,项目名称:cakephp-recaptcha,代码行数:12,代码来源:RecaptchaComponentTest.php

示例2: __construct

 /**
  * 初期化処理
  *
  * @access public
  */
 public function __construct()
 {
     // 「app.php」から画像アップロード先のパスを取得する
     Configure::config('default', new PhpConfig());
     Configure::load('app', 'default', false);
     $this->uploadFilePath = Configure::read('App.uploadFilePath');
     $this->uploadTempFilePath = Configure::read('App.uploadTempFilePath');
 }
开发者ID:bumptakayuki,项目名称:cakephp_20150919,代码行数:13,代码来源:ImageFileUtil.php

示例3: initialize

 /**
  * 初期化処理
  * beforeFilter()メソッドの前に呼び出される。
  *
  * @access public
  */
 public function initialize()
 {
     parent::initialize();
     // コンポーネント読み込み
     $this->loadComponent('Csrf');
     $this->loadComponent('Cookie');
     // 登録確認メールのURLを取得する
     Configure::config('default', new PhpConfig());
     Configure::load('app', 'default', false);
     $this->sendMailUrl = Configure::read('Email.default.addUserSendMailUrl');
 }
开发者ID:bumptakayuki,项目名称:cakephp_20150919,代码行数:17,代码来源:LoginController.php

示例4: PhpConfig

use Cake\Log\Log;
use Cake\Mailer\Email;
use Cake\Network\Request;
use Cake\Routing\DispatcherFactory;
use Cake\Utility\Inflector;
use Cake\Utility\Security;
/**
 * Read configuration file and inject configuration into various
 * CakePHP classes.
 *
 * By default there is only one configuration file. It is often a good
 * idea to create multiple configuration files, and separate the configuration
 * that changes from configuration that does not. This makes deployment simpler.
 */
try {
    Configure::config('default', new PhpConfig());
    Configure::load('app', 'default', false);
} catch (\Exception $e) {
    die($e->getMessage() . "\n");
}
// Load an environment local configuration file.
// You can use a file like app_local.php to provide local overrides to your
// shared configuration.
//Configure::load('app_local', 'default');
// When debug = false the metadata cache should last
// for a very very long time, as we don't want
// to refresh the cache while users are doing requests.
if (!Configure::read('debug')) {
    Configure::write('Cache._cake_model_.duration', '+1 years');
    Configure::write('Cache._cake_core_.duration', '+1 years');
}
开发者ID:Aerue,项目名称:avalia,代码行数:31,代码来源:bootstrap.php

示例5: testDumpPartial

 /**
  * Test dumping only some of the data.
  *
  * @return void
  */
 public function testDumpPartial()
 {
     Configure::config('test_Engine', new PhpConfig(TMP));
     Configure::write('Error', ['test' => 'value']);
     $result = Configure::dump('config_test', 'test_Engine', ['Error']);
     $this->assertTrue($result > 0);
     $result = file_get_contents(TMP . 'config_test.php');
     $this->assertContains('<?php', $result);
     $this->assertContains('return ', $result);
     $this->assertContains('Error', $result);
     $this->assertNotContains('debug', $result);
     if (file_exists(TMP . 'config_test.php')) {
         unlink(TMP . 'config_test.php');
     }
 }
开发者ID:rashmi,项目名称:newrepo,代码行数:20,代码来源:ConfigureTest.php

示例6: PhpConfig

use Cake\Mailer\Email;
use Cake\Network\Request;
use Cake\Routing\DispatcherFactory;
use Cake\Utility\Inflector;
use Cake\Utility\Security;
/**
 * Read configuration file and inject configuration into various
 * CakePHP classes.
 *
 * By default there is only one configuration file. It is often a good
 * idea to create multiple configuration files, and separate the configuration
 * that changes from configuration that does not. This makes deployment simpler.
 */
try {
    Configure::config('default', new PhpConfig());
    Configure::config('json', new Configure\Engine\JsonConfig());
    Configure::load('app', 'default', false);
    Configure::load('config', 'json', true);
} catch (\Exception $e) {
    exit($e->getMessage() . "\n");
}
// Load an environment local configuration file.
// You can use a file like app_local.php to provide local overrides to your
// shared configuration.
//Configure::load('app_local', 'default');
// When debug = false the metadata cache should last
// for a very very long time, as we don't want
// to refresh the cache while users are doing requests.
if (!Configure::read('debug')) {
    Configure::write('Cache._cake_model_.duration', '+1 years');
    Configure::write('Cache._cake_core_.duration', '+1 years');
开发者ID:ThreeCMS,项目名称:ThreeCMS,代码行数:31,代码来源:bootstrap.php

示例7: function

Security::salt(Configure::consume('Security.salt'));
/**
 * Setup detectors for mobile and tablet.
 */
Request::addDetector('mobile', function ($request) {
    $detector = new \Detection\MobileDetect();
    return $detector->isMobile();
});
Request::addDetector('tablet', function ($request) {
    $detector = new \Detection\MobileDetect();
    return $detector->isTablet();
});
/**
 * Load some bootstrap-handy information.
 */
Configure::config('QuickApps', new PhpConfig(TMP));
if (!is_readable(TMP . 'snapshot.php')) {
    snapshot();
} else {
    try {
        Configure::load('snapshot', 'QuickApps', false);
    } catch (\Exception $ex) {
        die('No snapshot found. check write permissions on tmp/ directory');
    }
}
/**
 * Load all registered plugins.
 */
$pluginsPath = [];
plugin()->each(function ($plugin) use(&$pluginsPath, $classLoader) {
    if (strtoupper($plugin->name) === 'CMS') {
开发者ID:quickapps-plugins,项目名称:cms,代码行数:31,代码来源:bootstrap_site.php

示例8: PhpConfig

/**
 * Read configuration file and inject configuration into various
 * CakePHP classes.
 *
 * By default there is only one configuration file. It is often a good
 * idea to create multiple configuration files, and separate the configuration
 * that changes from configuration that does not. This makes deployment simpler.
 */
try {
    Configure::config('default', new PhpConfig());
    Configure::load('app', 'default', false);
} catch (\Exception $e) {
    die($e->getMessage() . "\n");
}
try {
    Configure::config('appConst', new PhpConfig());
    Configure::load('appConst');
} catch (\Exception $e) {
    die($e->getMessage() . "\n");
}
// Load an environment local configuration file.
// You can use a file like app_local.php to provide local overrides to your
// shared configuration.
//Configure::load('app_local', 'default');
// When debug = false the metadata cache should last
// for a very very long time, as we don't want
// to refresh the cache while users are doing requests.
if (!Configure::read('debug')) {
    Configure::write('Cache._cake_model_.duration', '+1 years');
    Configure::write('Cache._cake_core_.duration', '+1 years');
}
开发者ID:ringiait,项目名称:portal,代码行数:31,代码来源:bootstrap.php

示例9: testStartupWithEmptyOptions

 /**
  * Test StartupWithEmptyOptions
  *
  * @return void
  */
 public function testStartupWithEmptyOptions()
 {
     Configure::config('default', new PhpConfig(PATH_TO_CONFIG_FILES));
     Configure::load('recaptchaWithEmptyOptions', 'default', false);
     $this->assertEquals('goodkey', Configure::read('Recaptcha.sitekey'));
     $this->assertEquals('goodsecret', Configure::read('Recaptcha.secret'));
     $this->assertEquals('', Configure::read('Recaptcha.lang'));
     $this->assertEquals('', Configure::read('Recaptcha.theme'));
     $this->assertEquals('', Configure::read('Recaptcha.type'));
 }
开发者ID:cake17,项目名称:cakephp-recaptcha,代码行数:15,代码来源:RecaptchaHelperTest.php

示例10: IniConfig

 *
 * Plugin::loadAll(); // Loads all plugins at once
 * Plugin::load('Migrations'); //Loads a single plugin named Migrations
 *
 */
Plugin::load('Migrations');
// Only try to load DebugKit in development mode
// Debug Kit should not be installed on a production system
if (Configure::read('debug')) {
    Plugin::load('DebugKit', ['bootstrap' => true]);
}
/**
 * Connect middleware/dispatcher filters.
 */
DispatcherFactory::add('Asset');
DispatcherFactory::add('Routing');
DispatcherFactory::add('ControllerFactory');
/**
 * Enable default locale format parsing.
 * This is needed for matching the auto-localized string output of Time() class when parsing dates.
 *
 * Also enable immutable time objects in the ORM.
 */
Type::build('time')->useImmutable()->useLocaleParser();
Type::build('date')->useImmutable()->useLocaleParser();
Type::build('datetime')->useImmutable()->useLocaleParser();
/**
 * Loading dbAdmin config file.
 */
Configure::config('ini', new IniConfig());
Configure::load('dbAdmin', 'ini');
开发者ID:aavrug,项目名称:cakeAdmin,代码行数:31,代码来源:bootstrap.php

示例11: dirname

<?php

use Cake\Core\Configure;
use Cake\Core\Configure\Engine\PhpConfig;
use Cake\Cache\Cache;
$configDir = dirname(__FILE__) . DS;
try {
    if (file_exists(CONFIG . '/banners_manager.php')) {
        Configure::load('banners_manager', 'default', false);
    } else {
        Configure::config('banners_manager_config', new PhpConfig($configDir));
        Configure::load('default_settings', 'banners_manager_config', false);
        Configure::drop('banners_manager_config');
    }
} catch (\Exception $e) {
    die($e->getMessage());
}
Cache::config('banners_manager_cache', ['className' => 'Cake\\Cache\\Engine\\FileEngine', 'duration' => '+1 week', 'probability' => 100, 'path' => CACHE . 'plugins' . DS . 'banners_manager' . DS]);
开发者ID:mswagencia,项目名称:banners-manager,代码行数:18,代码来源:bootstrap.php

示例12: PhpConfig

<?php

/**
 * Bootstrap
 *
 * @author   cake17
 * @license  http://www.opensource.org/licenses/mit-license.php The MIT License
 * @link     http://blog.cake-websites.com/
 */
use Cake\Core\Configure;
use Cake\Core\Configure\Engine\PhpConfig;
use Recaptcha\Validation\ConfigValidator;
// Pass the config data from config/recaptcha.php to Configure Class
// If the file does not exist, an exception is thrown
Configure::config('default', new PhpConfig(dirname(APP) . DS . 'config' . DS));
Configure::load('recaptcha', 'default', false);
// Validate the Configure Data
$validator = new ConfigValidator();
$errors = $validator->errors(Configure::read('Recaptcha'));
if (!empty($errors)) {
    throw new \Exception(__d('recaptcha', 'One of your recaptcha config value is incorrect'));
    // throw an exception with config error that is raised
}
开发者ID:cake17,项目名称:cakephp-recaptcha,代码行数:23,代码来源:bootstrap.php

示例13: PhpConfig

use Cake\Network\Email\Email;
use Cake\Network\Request;
use Cake\Routing\DispatcherFactory;
use Cake\Utility\Inflector;
use Cake\Utility\Security;
/**
 * Read configuration file and inject configuration into various
 * CakePHP classes.
 *
 * By default there is only one configuration file. It is often a good
 * idea to create multiple configuration files, and separate the configuration
 * that changes from configuration that does not. This makes deployment simpler.
 */
try {
    Configure::config('default', new PhpConfig());
    Configure::config('project', new PhpConfig(PROJECT_CONFIG));
    Configure::load('app', 'project', false);
    Configure::write('App.namespace', 'BEdita\\Manage');
} catch (\Exception $e) {
    die($e->getMessage() . "\n");
}
// Load an environment local configuration file.
// You can use a file like app_local.php to provide local overrides to your
// shared configuration.
//Configure::load('app_local', 'default');
// When debug = false the metadata cache should last
// for a very very long time, as we don't want
// to refresh the cache while users are doing requests.
if (!Configure::read('debug')) {
    Configure::write('Cache._cake_model_.duration', '+1 years');
    Configure::write('Cache._cake_core_.duration', '+1 years');
开发者ID:bedita,项目名称:bedita4-sandbox,代码行数:31,代码来源:bootstrap.php


注:本文中的Cake\Core\Configure::config方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。