本文整理汇总了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);
}