博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
简单的按月建立流水表类
阅读量:7284 次
发布时间:2019-06-30

本文共 1216 字,大约阅读时间需要 4 分钟。

1     class createTableAction{ 2         public function index(){ 3             $dateSuffix = date('Y-m'); 4             $checkTable = $dateSuffix.'statistics'; 5             $res = $this->checkTables($checkTable); 6             if(!$res){ 7                 $checkTable = $this->createTable($checkTable); 8             } 9         }10         //检测数据表是否存在11         protected function checkTables($tables){12             $tables = date('Y-m').'statistics';13             $sql = "show tables like '{
$tables}'";14 $res = M()->query($sql);15 if($res){16 return true;17 }else{18 return false;19 }20 } 21 //建立数据表22 private function createTable($tables){23 $sql = "24 create table if not exists `{
$tables}`(25 `id` bigint(20) not null primary key auto_increment,26 `is_show` smallint(1) default 0 27 ) ENGINE=MyISAM DEFAULT CHARSET=utf8;";28 M()->query($sql);29 //echo M()->getLastsql();30 return $table;31 }32 }
View Code

 

转载于:https://www.cnblogs.com/ikasa007/p/3760739.html

你可能感兴趣的文章
我讨厌注解式的Spring IOC
查看>>
大龄程序媛之歌
查看>>
php 去除数组某一个元素
查看>>
Ehcache(08)可阻塞的Cache-BlockingCache
查看>>
Spring-Boot(六) Spring Session 分布式会话管理
查看>>
iptables进行端口转发
查看>>
基于Hadoop的云盘系统客户端技术选型说明
查看>>
linux下C语言多线程编程实例--修改后
查看>>
我的友情链接
查看>>
更新脚本
查看>>
用Android-X86和VMware打造高性能Android开发环境
查看>>
我的友情链接
查看>>
学习Hadoop找到的一些资源
查看>>
经纬度精度差别
查看>>
【08】分析类
查看>>
垃圾收集的种类
查看>>
HRegionServer启动后自动关闭的问题
查看>>
maven插件assembly利用profiles打不同环境发布包
查看>>
Android系统学习总结1--init和Zygote
查看>>
linux 下查看一个进程运行路径
查看>>