本文整理汇总了PHP中core\Config类的典型用法代码示例。如果您正苦于以下问题:PHP Config类的具体用法?PHP Config怎么用?PHP Config使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Config类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: sendMail
public static function sendMail($data)
{
$transport = Swift_SmtpTransport::newInstance(Config::get('smtp.server'), Config::get('smtp.port'))->setUsername(Config::get('smtp.username'))->setPassword(Config::get('smtp.password'));
$mailer = Swift_Mailer::newInstance($transport);
$message = Swift_Message::newInstance($data['subject'])->setFrom([Config::get('smtp.username') => Config::get('framework.title')])->setTo([$data['to']])->setContentType('text/html')->setBody($data['text']);
return $mailer->send($message);
}
开发者ID:sikamy,项目名称:sephy-framework,代码行数:7,代码来源:Mail.php
示例2: _initDb
/**
* Init database
*/
private static function _initDb()
{
$config = \Core\Config::getInstance();
$dbConnection = new PDO($config->database['driver'] . ':host=' . $config->database['host'] . ';dbname=' . $config->database['dbname'], $config->database['user'], $config->database['password'], array(PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES utf8"));
$dbConnection->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
\Core\Db\Connector::getInstance()->setConnection($dbConnection);
}
开发者ID:elfingit,项目名称:webcrm,代码行数:10,代码来源:Bootstrap.php
示例3: __construct
public function __construct($data)
{
if (isset($data)) {
$this->_data = $data;
}
$this->_db = Database::getInstance(Config::get('mysql/host'), Config::get('mysql/db'), Config::get('mysql/user'), Config::get('mysql/pass'));
}
开发者ID:endever,项目名称:PHPancy,代码行数:7,代码来源:Validate.php
示例4: __construct
public function __construct()
{
//Setup extra autoloader.
new Autoloader(Config::get("autoloader"));
$this->setVars();
$this->run();
}
开发者ID:Rinkana,项目名称:SoIsLife,代码行数:7,代码来源:Kernel.php
示例5: endAction
public function endAction()
{
$orderId = (int) Route::param('id');
if ($orderId and isset($_POST) and count($_POST) > 0) {
$data = json_decode(base64_decode($_POST['data']), true);
$order = DB::select()->from('afisha_orders')->where('id', '=', $orderId)->find();
if (!$order) {
return Config::error();
}
// update status
if ($data['status'] && $data['status'] == 'success') {
Common::update('afisha_orders', array('status' => 'success', 'updated_at' => time()))->where('id', '=', $orderId)->execute();
// Change status for seats
$prices = DB::select('id')->from('prices')->where('afisha_id', '=', $order->afisha_id)->find_all();
$pricesArr = array();
if (count($prices)) {
foreach ($prices as $key => $value) {
$pricesArr[] = $value->id;
}
$res2 = \Core\Common::update('seats', array('status' => 3))->where('view_key', 'IN', array_filter(explode(',', $order->seats_keys)))->where('price_id', 'IN', $pricesArr)->execute();
}
}
}
// HTTP::redirect('after_payment/');
return;
}
开发者ID:procivam,项目名称:hochu-bilet-v3,代码行数:26,代码来源:Payment.php
示例6: checkFromTld
/**
* 从tld判断域名
*/
public function checkFromTld($domain)
{
$tld = (array) \Core\Config::item('tld');
$provinceTld = (array) \Core\Config::item('provinceTld');
$suffix = \common\Common::getDomainAllTld($domain);
return in_array($suffix, $tld) || in_array($suffix, $provinceTld) ? array('flag' => 1) : array('flag' => 0);
}
开发者ID:nicklos17,项目名称:eapi,代码行数:10,代码来源:DomainLogic.php
示例7: checkAcuctionStatusAction
/**
* 定时处理竞价结束的数据处理
*
*
*/
public function checkAcuctionStatusAction()
{
// step1 取出已过交易结束时间,类型为竞价的并且有买家id的交易记录
$taoModel = new NewTaoModel();
$taoData = $taoModel->getExpiredByType(\core\Config::item('isInquiry')->toArray()[1], time());
// step2 将step1的记录修改状态为等待买卖双方确认的状态,存到new_trans_result表,并更新用户关注表
$historyModel = new NewTransHistoryModel();
$transLogic = new TransLogic();
if (!empty($taoData)) {
foreach ($taoData as $data) {
$data = get_object_vars($data);
$data['t_status'] = 2;
//存表
if ($historyModel->setTransHistory($data)) {
//更新用户关注表
if ($transLogic->updateWatchInfo($data['t_id'], $data['t_now_price'], $data['t_nickname'], $endTime = $data['t_end_time'])) {
// step3 删除new_tao里面该条交易记录
if ($taoModel->delByTid($data['t_id'])) {
echo 'tid 为' . $data['t_id'] . '操作成功';
} else {
echo 'tid 为' . $data['t_id'] . '删除net_tao原表数据失败';
}
} else {
echo 'tid 为' . $data['t_id'] . '更新用户关注表失败';
}
} else {
echo 'tid 为' . $data['t_id'] . '复制到history 失败';
}
}
}
}
开发者ID:nicklos17,项目名称:eapi,代码行数:36,代码来源:OktoresTask.php
示例8: render
/**
* Make a URL that links to a controller/action/variables.
*
* By default we do not use the URL variables, but you can chose to do so.
*
* <code>
* array(
* 'controller' => 'Index',
* 'action' => 'Index',
* 'variables' => array(
* 'foo' => 'bar',
* 'bar' => 'foobar'
* )
* 'variable_retain' => false
* )
* </code>
*
* @access public
* @param array $param Parameters used to build the URL.
* @return string
*/
public function render($param = array())
{
// Set some defaults
$defaults = array('controller' => $this->controller, 'action' => '', 'variables' => isset($param['variable_retain']) && $param['variable_retain'] ? $_GET : array(), 'variable_retain' => false);
// However, we do not want the controller/action in the variable list
unset($defaults['variables']['controller'], $defaults['variables']['action']);
// Merge these in with the parameters
// Parameters will take precedence
$param = array_merge($defaults, $param);
// Start to build URL
// The controller
$url = Core\Config::get('path', 'root') . $param['controller'] . '/' . $param['action'];
// Any variables
if ($param['variables']) {
// Yes, there are variables to append, loop over them
foreach ($param['variables'] as $variable => $value) {
// If there is an odd amount of variables in the URL string
// .. then we just set the last variable to true. This needs
// .. to be the same in this case also.
$url .= '/' . urlencode($variable) . '/' . ($value === true ? '' : $value);
}
}
// URL has finished constructing, pass back
return $url;
}
开发者ID:johann-weiss,项目名称:MVC,代码行数:46,代码来源:Url.php
示例9: getConfig
/**
* Retourne l'instance de Config
* @param $key
* @return \Core\Config
*/
public function getConfig($key)
{
if (is_null($this->config_instance)) {
$this->config_instance = Config::getInstance();
}
return $this->config_instance->get($key);
}
开发者ID:kMeillet,项目名称:mp3-player-api-js,代码行数:12,代码来源:App.php
示例10: downAction
/**
* 从new_tao表中找出状态为15的交易,请求dc接口解锁域名,解锁成功后,将该记录复制到new_trans_history表,同时从new_tao表删除该记录
*
*
*
*/
public function downAction()
{
$taoModel = new NewTaoModel();
$taoData = $taoModel->getDataByStatus(15);
if (!empty($taoData)) {
$dLogic = new DomainLogic();
foreach ($taoData as $v) {
$data[$v->t_id] = (array) $v;
$res = $dLogic->setDomainStatus(\core\Config::item('doPubSta')->toArray()['down'], 1);
if ($res !== true) {
unset($data[$v->t_id]);
echo "解锁new_tao状态为15的域名id{$v->t_id}失败,解锁时间:" . date('Y-m-d H:i:s', $_SERVER['REQUEST_TIME']) . "\n";
}
}
if (!empty($data)) {
$data = array_values($data);
$TransLogic = new TransLogic();
//将信息更新到历史表中,并在new_tao中删除
foreach ($data as $v) {
$copyRes = $TransLogic->copyToHistory($v, $v['t_status']);
$delRes = $TransLogic->delByTid($v['t_id']);
if (!$copyRes) {
echo "域名id{$v['t_id']}解锁成功,但在插入new_trans_history时发生错误.时间:" . date('Y-m-d H:i:s', $_SERVER['REQUEST_TIME']) . "\n";
}
if (!$delRes) {
echo "域名id{$v['t_id']}解锁成功,但在从new_tao删除该条记录时发生错误.时间:" . date('Y-m-d H:i:s', $_SERVER['REQUEST_TIME']) . "\n";
}
}
}
}
}
开发者ID:nicklos17,项目名称:eapi,代码行数:37,代码来源:DownqueueTask.php
示例11: innerAction
public function innerAction()
{
$this->_template = 'CatalogItemsWithoutFilter';
$page = !(int) Route::param('page') ? 1 : (int) Route::param('page');
// Check for existance
$brand = DB::select()->from('brands')->where('alias', '=', Route::param('alias'))->where('status', '=', 1)->as_object()->execute()->current();
if (!$brand) {
return Config::error();
}
// Seo
$this->_seo['h1'] = $brand->h1;
$this->_seo['title'] = $brand->title;
$this->_seo['keywords'] = $brand->keywords;
$this->_seo['description'] = $brand->description;
$this->setBreadcrumbs($brand->name);
// Get count items per page
$limit = (int) Arr::get($_GET, 'per_page') ? (int) Arr::get($_GET, 'per_page') : Config::get('limit');
// Get sort type
$sort = in_array(Arr::get($_GET, 'sort'), array('name', 'created_at', 'cost')) ? Arr::get($_GET, 'sort') : 'sort';
$type = in_array(strtolower(Arr::get($_GET, 'type')), array('asc', 'desc')) ? strtoupper(Arr::get($_GET, 'type')) : 'ASC';
// Get popular items
$result = DB::select(array('catalog_images.image', 'image'), 'catalog.*')->from('catalog')->join('catalog_images', 'LEFT')->on('catalog_images.catalog_id', '=', 'catalog.id')->on('catalog_images.main', '=', DB::expr('1'))->where('catalog.brand_id', '=', $brand->id)->where('catalog.status', '=', 1)->order_by('catalog.' . $sort, $type)->limit($limit)->offset(($page - 1) * $limit)->as_object()->execute();
// Set description of the brand to show it above the sort part
Config::set('brand_description', View::tpl(array('brand' => $brand), 'Brands/Inner'));
// Count of parent groups
$count = DB::select(array(DB::expr('COUNT(catalog.id)'), 'count'))->from('catalog')->where('brand_id', '=', $brand->id)->where('status', '=', 1)->as_object()->execute()->current()->count;
// Generate pagination
$pager = Pager::factory($page, $count, $limit)->create();
// Render template
$this->_content = View::tpl(array('result' => $result, 'pager' => $pager), 'Catalog/ItemsList');
}
开发者ID:procivam,项目名称:hochu-bilet-v3,代码行数:31,代码来源:Brands.php
示例12: Instance
public static function Instance($database = NULL)
{
if (!isset(self::$instances[$database])) {
if (is_null($database)) {
$db_info = Config::Get('database');
} else {
$db_info = array('name' => $database);
}
$db_file = Config::Path(Config::DIR_DATA . DIRECTORY_SEPARATOR . $db_info['name'] . SQLite::DB_EXTENSION);
if (!file_exists($db_file)) {
$schema = file_get_contents(Config::Path(Config::DIR_DATA . DIRECTORY_SEPARATOR . $db_info['name'] . SQLite::INIT_EXTENSION));
$schema = str_replace("\n", ' ', $schema);
$schema = str_replace("\r", ' ', $schema);
$db = new SQLite3($db_file, SQLITE3_OPEN_CREATE | SQLITE3_OPEN_READWRITE);
$db->exec($schema);
}
// load database
self::$instances[$database] = new PDO('sqlite:' . $db_file);
if (Config::Get('debug')) {
self::$instances[$database]->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
} else {
self::$instances[$database]->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_SILENT);
}
self::$instances[$database]->setAttribute(PDO::ATTR_DEFAULT_FETCH_MODE, PDO::FETCH_ASSOC);
}
self::$access++;
return self::$instances[$database];
}
开发者ID:Devenet,项目名称:MoodPicker,代码行数:28,代码来源:sqlite.php
示例13: run
public function run()
{
$config = Config::get('socket');
$config = array('worker_num' => 4, 'task_worker_num' => 8, 'max_request' => 10000, 'dispatch_mode' => 2, 'debug_mode' => 0, 'daemonize' => false);
if (isset($argv[1]) and $argv[1] == 'daemon') {
$config['daemonize'] = true;
} else {
$config['daemonize'] = false;
}
$serv = new \swoole_server("0.0.0.0", 8808);
$serv->set($config);
$serv->config = $config;
$handler = new Handler();
$serv->on('Start', array($handler, "start"));
$serv->on('Connect', array($handler, "connect"));
$serv->on('Receive', array($handler, "receive"));
$serv->on('Close', array($handler, "close"));
$serv->on('Shutdown', array($handler, "shutdown"));
$serv->on('Timer', array($handler, "timer"));
$serv->on('WorkerStart', array($handler, "workStart"));
$serv->on('WorkerStop', array($handler, "workStop"));
$serv->on('Task', array($handler, "task"));
$serv->on('Finish', array($handler, "finish"));
$serv->on('WorkerError', array($handler, "workError"));
$serv->start();
}
开发者ID:AimuTran,项目名称:iChat,代码行数:26,代码来源:Socket.class.php
示例14: getURL
public function getURL($params, $clean = true)
{
$request = \Core\Http\Request::getInstance();
if ($clean) {
$params = array_merge(array('module' => $request->getModule(), 'controller' => $request->getController(), 'action' => $request->getAction()), $params);
} else {
$p = $request->getParams();
$names = array_keys($_POST);
foreach ($p as $n => $v) {
if (in_array($n, $names)) {
unset($p[$n]);
}
}
$params = array_merge(array('module' => $request->getModule(), 'controller' => $request->getController(), 'action' => $request->getAction()), $p, $params);
}
$module = $params['module'];
$controller = $params['controller'];
$action = $params['action'];
unset($params['module']);
unset($params['controller']);
unset($params['action']);
$uri = \Core\Config::getInstance()->app['baseUrl'] . $module . '/' . $controller . '/' . $action . '/';
if (!empty($params)) {
$ps = array_keys($params);
foreach ($ps as $param) {
if ($param == session_name()) {
continue;
}
if (!is_null($params[$param])) {
$uri .= $param . '/' . $params[$param] . '/';
}
}
}
return $uri;
}
开发者ID:elfingit,项目名称:webcrm,代码行数:35,代码来源:Url.php
示例15: config
function config($name, $value = null)
{
if (!$value) {
return Config::get($name);
}
Config::set($name, $value);
}
开发者ID:sunkangtaichi,项目名称:PHPAPPLISTION_START,代码行数:7,代码来源:Function-Core-Namespace.php
示例16: before
function before()
{
parent::before();
$this->_seo['h1'] = 'Заказы в один клик';
$this->_seo['title'] = 'Заказы в один клик';
$this->setBreadcrumbs('Заказы в один клик', 'backend/' . Route::controller() . '/index');
$this->limit = Config::get('limit_backend');
}
开发者ID:procivam,项目名称:hochu-bilet-v3,代码行数:8,代码来源:Simple.php
示例17: getUrl
public function getUrl($params)
{
$path = $this->path;
foreach ($params as $k => $v) {
$path = str_replace(":{$k}:", $v, $path);
}
return Config::getInstance()->get('url') . $path;
}
开发者ID:kMeillet,项目名称:mp3-player-api-js,代码行数:8,代码来源:Route.php
示例18: getDb
public function getDb()
{
$config = Config::getInstance(ROOT . '/config/config.php');
if (is_null($this->db_instance)) {
$this->db_instance = new MySQLDatabase($config->get("db_name"), $config->get("db_user"), $config->get("db_pass"), $config->get("db_host"));
}
return $this->db_instance;
}
开发者ID:LoRayZm,项目名称:portfolio2,代码行数:8,代码来源:App.php
示例19: config
private function config()
{
$result = DB::select('key', 'zna')->from('config')->where('status', '=', 1)->find_all();
foreach ($result as $obj) {
Config::set($obj->key, $obj->zna);
}
$this->setBreadcrumbs('Главная', 'backend');
}
开发者ID:procivam,项目名称:hochu-bilet-v3,代码行数:8,代码来源:Base.php
示例20: handle
public function handle()
{
$aConfig = c\Config::get('dsn');
u\DB::connect($aConfig['data']);
$aData = parent::handle();
$aData['data']['host'] = "http://{$_SERVER['HTTP_HOST']}/?static=";
return $aData;
}
开发者ID:sdgdsffdsfff,项目名称:open-sesame,代码行数:8,代码来源:Base.php
注:本文中的core\Config类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论