csa12/yii2-data
Composer 安装命令:
composer require csa12/yii2-data
包简介
Yii 2.0 database additions
关键字:
README 文档
README
These database additions for Yii 2.0 add certain features
for development purposes by CSA and can perhaps be of use to others.
This repository is available via https://github.com/csa12/yii2-data. For license information check the LICENSE-file.
Installation
The preferred way to install is through composer.
Either run
composer require csa12/yii2-data
or add
"csa12/yii2-data": "dev-master",
to the require section of your composer.json.
Usage
To use this extension, simply add the following code at the beginning of views/layouts/main.php or any other view file where you would like to check your database connection or table(s) existence.
use csa\data\Database;
<?php
$tableNames = ['name_of_database_table1', 'name_of_database_table2'];//or []
$db = Database::checkDb($tableNames);
$this->beginPage() ?>
...
And if so desired you can disable showing your content, when the database or table is not found, by adding the following code around the within views/layouts/main.php
...
<?php if ($db) { ?>
<?= $content ?>
<? } ?>
...
Note
This version is still under development and not intended for use in any production evironments.
统计信息
- 总下载量: 9
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: BSD-3-Clause
- 更新时间: 2015-10-04