本文整理汇总了PHP中Config::write方法的典型用法代码示例。如果您正苦于以下问题:PHP Config::write方法的具体用法?PHP Config::write怎么用?PHP Config::write使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Config
的用法示例。
在下文中一共展示了Config::write方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testWrite
/**
* @covers Config::write
* @todo Implement testWrite().
*/
public function testWrite()
{
$config = array('app_key' => 'appkeyvalue', 'user_key' => 'userkeyvalue');
$this->object->setConfig($config);
echo getcwd();
$this->object->setFileName('data/testOutputFile.ini');
$this->object->write();
$this->assertEquals($config, $this->object->read());
unlink($this->object->getFileName());
}
示例2: testEmpty
public function testEmpty()
{
file_put_contents($this->file, '');
$this->assertEquals($this->object->get('test.trees.oak.fairies', 'default'), 'default');
$this->object->set('test.trees.oak.second_fairy', 'Trixie');
$this->assertEquals($this->object->get('test.trees.oak.second_fairy'), 'Trixie');
$this->object->write('test');
$group = $this->object->get('test');
$this->assertArrayHasKey('trees', $group);
$this->assertArrayHasKey('oak', $group['trees']);
$this->assertArrayHasKey('second_fairy', $group['trees']['oak']);
$this->assertEquals($group['trees']['oak']['second_fairy'], 'Trixie');
}
示例3: destruct
/**
* Shuts the bot down
*
* @return void
*/
public static function destruct() {
// break in child
if (self::$bot !== null) {
if (!self::$bot->isParent()) return;
}
self::$log->info = 'Shutting down';
// send leave message
self::$bot->getConnection()->leave();
if (VERBOSE > 0) self::$log->info = 'Left chat';
// write the configs
self::$config->write();
if (VERBOSE > 0) self::$log->info = 'Written config';
// call destructors of modules
foreach (self::$modules as $module) {
$module->destruct();
}
if (VERBOSE > 0) self::$log->info = 'Unloading modules';
// clear class cache
$files = glob(DIR.'cache/*');
foreach ($files as $file) {
unlink($file);
}
if (VERBOSE > 0) self::$log->info = 'Cleaned cache';
unlink(DIR.'bot.pid');
}
示例4: stage1
public function stage1()
{
if (Input::method() == 'POST') {
// run patch containing the changes
require PATH . 'upgrade/patch.php';
Migrations::apply();
Config::write(PATH . 'config.php', Config::get());
return redirect('complete');
}
render('stage1');
}
示例5: __construct
public function __construct($file)
{
// Define path to application directory
Config::write('BASE_PATH', $file);
Config::write('APP_PATH', $file . '/../app');
Config::write('SITE_NAME', 'Marketing Evolution');
Config::write('SITE_URL', 'http://marketingevolution.com');
//invoke the rest object.
$rest = new \kiss\Rest();
//Return response to context
$this->response = $rest->response();
}
示例6: get_generic_access_token
function get_generic_access_token()
{
$client = new \GuzzleHttp\Client();
$response = $client->post(Config::get('motibu.API_URL') . 'oauth/client_cred_grant_token', ['body' => ['client_id' => Config::get('motibu.CLIENT_ID'), 'client_secret' => Config::get('motibu.CLIENT_SECRET'), 'grant_type' => 'client_credentials']]);
$response = $response->json();
Log::info($response);
if (!array_key_exists('access_token', $response) && !strlen($response['access_token'])) {
return false;
} else {
Config::write('access.client_token', $response['access_token']);
Config::set('access.client_token', $response['access_token']);
return true;
}
}
示例7: postEdit
public function postEdit()
{
$rules = ['phone' => 'required|min:4', 'email' => 'required|email', 'company' => 'required|min:3', 'title' => 'required|min:20', 'description' => 'required|min:50', 'author' => 'required|min:5', 'keywords' => 'required|min:20', 'address' => 'required|min:5', 'mode' => 'required|min:10', 'zoom' => 'required|min:1|max:40|integer', 'latitude' => 'required|min:1|max:90', 'longitude' => 'required|min:1|max:90'];
$validator = Validator::make(Input::all(), $rules);
if ($validator->fails()) {
return Redirect::to("admin/setting")->withErrors($validator)->withInput(Input::except(''));
}
//dd(Input::all());
foreach ($rules as $key => $value) {
Config::write('setting.' . $key, Input::get($key));
}
if (Input::get('parameters')) {
$parameters = json_decode(Input::get('parameters'));
$img = Image::make($parameters->name);
$img->crop($parameters->w, $parameters->h, $parameters->x, $parameters->y);
$img->resize(Config::get('setting.logo.w'), Config::get('setting.logo.h'));
$img->save(Config::get('setting.logo.path'));
File::delete($parameters->tmp);
$img->destroy();
}
return Redirect::to("admin/setting")->with('success', trans("message.setting"));
}
示例8: get_connection
<?php
// Site
Config::write('site.domain', $_SERVER['SERVER_NAME']);
Config::write('site.protocol', 'http');
// Database
Config::write('db.prefix', 'pgsql');
$Connection = get_connection();
$Connection->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
// Initialisation
Config::write('var.showsession', FALSE);
//Developent
Config::write('dev.noemail', TRUE);
示例9: array
<?php
abstract class Config
{
private static $_config = array();
public static function get($name)
{
return self::$_config[$name];
}
public static function write($name, $value)
{
self::$_config[$name] = $value;
}
}
require __DIR__ . '/user/config.php';
foreach ($config as $name => $value) {
Config::write($name, $value);
}
示例10: testShouldReadAndWriteConfigValues
/**
* @testdox should read and write config values
*/
public function testShouldReadAndWriteConfigValues()
{
Config::write('Test.status', $expected = 'success');
$actual = Config::read('Test.status');
$this->assertEquals($expected, $actual);
}
示例11: switchToPrimaryDomain
/**
* Switch config to use primary domain (for multi domain testing).
*
* Switch will happen only if a first switch to secondary domain was done first.
*/
public function switchToPrimaryDomain()
{
// Switch needs to be done only if a switch to secondary domain was done first.
if (Config::read('passbolt.url_primary')) {
// Reset the config with the base url.
Config::write('passbolt.url', Config::read('passbolt.url_primary'));
PassboltServer::resetExtraConfig();
}
}
示例12: array
<?php
/**
* ROUTES
*
* Configurações de redirecionamento de URL.
*
* Por padrão, o sistema procura por qualquer endereço escrito no índice de
* array $routes e redireciona tudo.
*
*
* Os Routes são lidos na ordem. O sistema vai usar o primeiro item que
* coincidir com o padrão.
*
*/
$routes = array("/:controller/:action/:arg" => array("controller" => ":controller", "action" => ":action", ":arg"), "/:controller/:action" => array("controller" => ":controller", "action" => ":action"), "/" => array("controller" => "site", "action" => "index"));
/**
* Salva a configuração acima
*/
Config::write("routes", $routes);
示例13: array
<?php
/**
* Liteframe PHP Framework
* @author Nabeel Shahzad
* @copyright Copyright (c) 2009 - 2010, Nabeel Shahzad
* @link http://github.com/nshahzad/liteframe
*
*/
namespace Liteframe;
# The default routing
Config::write('DEFAULT_CONTROLLER', 'default');
# Your default site title
Config::write('SITE_TITLE', 'liteframe');
# This is the default, used with the $this->url() function
Config::write('BASE_URL', $_SERVER['SERVER_NAME']);
# Use a mod-rewrite rule, or default will be ?q=
# Used with the $this->url() function to generate URLs
Config::write('USE_REWRITE', true);
Config::write('DATABASE_CONNECTIONS', array('example' => 'mysql://username:password@localhost/database_name'));
# If this is not blank, then a DB connection will be made
# Should be one of the indexes from above
Config::write('DATABASE_CONNECTOR', '');
示例14: date_default_timezone_set
<?php
// Time zone
date_default_timezone_set('Australia/Adelaide');
// Site
Config::write('site.title', 'Australian Curriculum Engagement Tool');
Config::write('site.includenone', FALSE);
// Email
// (Uncomment only one of the following three
// Config::write('email.transporttype','Smtp');
Config::write('email.transporttype', 'Sendmail');
// Config::write('email.transporttype','Mail');
// SMTP
Config::write('smtp.host', 'smtp.gmail.com');
Config::write('smtp.port', '465');
Config::write('smtp.encr', 'ssl');
Config::write('smtp.user', 'andmos@gmail.com');
Config::write('smtp.pass', 'ttrezhjcrurgvlaq');
// Sendmail
Config::write('email.sendmail', '/usr/sbin/sendmail -bs');
// Database
Config::write('db.host', '127.0.0.1');
Config::write('db.user', 'amoschou');
Config::write('db.port', '5432');
Config::write('db.password', '');
Config::write('db.basename', 'acmathematicsweb');
// Password
Config::write('password.cost', 11);
示例15:
<?php
// Models
include_once "models/class.UserModel.php";
include_once "models/class.RoleModel.php";
// Views
include_once "views/class.UserSearchView.php";
include_once "views/class.UserDetailView.php";
include_once "views/class.LoginView.php";
include_once "views/class.LoginTimeOutView.php";
// Controllers
include_once "controllers/class.User.php";
include_once "controllers/class.Login.php";
// Pages URL's
Config::write('page.url.user.search', Config::read('url.admin') . "/user/search");
Config::write('page.url.user.detail', Config::read('url.admin') . "/user/detail");
Config::write('page.url.user.remove', Config::read('url.admin') . "/user/remove");
Config::write('page.url.login', Config::read('url.admin'));
Config::write('page.url.login.inactive', Config::read('url.admin') . "/login/inactive");
Config::write('page.url.login.logoff', Config::read('url.admin') . "/login/logoff");