本文整理匯總了PHP中app\Config::getInstance方法的典型用法代碼示例。如果您正苦於以下問題:PHP Config::getInstance方法的具體用法?PHP Config::getInstance怎麽用?PHP Config::getInstance使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類app\Config
的用法示例。
在下文中一共展示了Config::getInstance方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: database_start
function database_start()
{
$config = \App\Config::getInstance()->get('database');
switch (strtolower($config['active'])) {
case 'mysql':
ORM::configure(sprintf('mysql:host=%s;dbname=%s', $config['mysql']['hostname'], $config['mysql']['name']));
ORM::configure('username', $config['mysql']['username']);
ORM::configure('password', $config['mysql']['password']);
}
}
示例2: News
<?php
use App\Models\User;
use App\Models\News;
use App\Config;
include 'autoload.php';
$articles = News::findAll();
include 'Assets/head.php';
$config = Config::getInstance();
var_dump($config);
/*
$news = new News();
$news->title = "Мой заголовок";
$news->text = "Мой текст";
$date = date("Y-m-d",strtotime($date));
$news->date = $date;
$news->save();
foreach ($articles as $news)
{
echo "<table>";
echo "<tr><td><a href='article.php?id=". $news->id ."'>";
echo $news->title;
echo "</a></td><tr>";
echo "<tr><td>";
echo $news->text;
echo "</td><tr>";
echo "</table>";
}
*/
include 'Assets/bottom.php';
示例3: __callStatic
/**
* Gestion en appel statique
*
* @return Config
*/
public static function __callStatic($method, $arguments)
{
$object = Config::getInstance();
return call_user_func_array([$object, $method], $arguments);
}