本文整理汇总了PHP中core\Config::Get方法的典型用法代码示例。如果您正苦于以下问题:PHP Config::Get方法的具体用法?PHP Config::Get怎么用?PHP Config::Get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类core\Config
的用法示例。
在下文中一共展示了Config::Get方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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];
}
示例2: Application
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Code source hosted on https://github.com/Devenet/MoodPicker
*/
set_include_path('./library');
spl_autoload_extensions('.php');
spl_autoload_register();
use Core\Application;
use Core\Config;
use Core\Setting;
use Utils\Menu;
use Manage\Authentification;
if (Config::Get('debug')) {
error_reporting(-1);
ini_set('display_errors', 1);
} else {
error_reporting(0);
ini_set('display_errors', 0);
}
$app = new Application();
$auth = new Authentification();
$navbar = new Menu();
$navbar->item($app->URL(), 'Share')->item($app->URL('review'), 'Review')->item($app->URL('details'), 'Details');
$navbar_right = new Menu();
if ((new Setting('api_display_doc'))->getValue() || $auth->isLogged()) {
$navbar_right->item($app->URL('api'), 'API');
} else {
if ((new Setting('api_requests'))->getValue()) {
示例3: display
protected function display()
{
try {
$this->template->draw($this->page);
} catch (\Rain\Tpl\NotFoundException $ex) {
if (Config::Get('debug')) {
$tpl = $ex->getTrace()[0]['args'][0] == 404 ? htmlspecialchars($_GET['template']) : $ex->getTrace()[0]['args'][0];
$this->assign('exception', $tpl);
}
header('HTTP/1.1 404 Not Found', TRUE, 404);
$this->template->assign('navbar', $this->modules[Menu::NAVBAR]->generate('404'));
$this->template->draw('_404');
}
}
示例4: __construct
private function __construct()
{
$this->themes = Config::Get('themes');
$this->theme = is_null(Config::Get('theme')) ? self::DEFAULT_THEME : Config::Get('theme');
}