35 lines
1.2 KiB
PHP
35 lines
1.2 KiB
PHP
|
<?php
|
||
|
// +----------------------------------------------------------------------
|
||
|
// | 海豚PHP框架 [ DolphinPHP ]
|
||
|
// +----------------------------------------------------------------------
|
||
|
// | 版权所有 2016~2017 河源市卓锐科技有限公司 [ http://www.zrthink.com ]
|
||
|
// +----------------------------------------------------------------------
|
||
|
// | 官方网站: http://dolphinphp.com
|
||
|
// +----------------------------------------------------------------------
|
||
|
// | 开源协议 ( http://www.apache.org/licenses/LICENSE-2.0 )
|
||
|
// +----------------------------------------------------------------------
|
||
|
|
||
|
use think\Db;
|
||
|
use think\Exception;
|
||
|
// cms模块卸载文件
|
||
|
|
||
|
// 是否清除数据
|
||
|
$clear = $this->request->get('clear');
|
||
|
|
||
|
if ($clear == 1) {
|
||
|
// 内容模型的表名列表
|
||
|
$table_list = Db::name('cms_model')->column('table');
|
||
|
|
||
|
if ($table_list) {
|
||
|
foreach ($table_list as $table) {
|
||
|
// 删除内容模型表
|
||
|
$sql = 'DROP TABLE IF EXISTS `'.$table.'`;';
|
||
|
try {
|
||
|
Db::execute($sql);
|
||
|
} catch (\Exception $e) {
|
||
|
throw new Exception('删除表:'.$table.' 失败!', 1001);
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|