重庆分公司,新征程启航
为企业提供网站建设、域名注册、服务器等服务
public function promotion_list()
{
$sql = "CREATE TABLE `ka_sys` (
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT '自增ID',
`sys_name` varchar(45) CHARACTER SET utf8 NOT NULL COMMENT '系统中文名称',
`eng_name` varchar(65) DEFAULT NULL,
`sys_logo1` varchar(65) CHARACTER SET utf8 DEFAULT NULL COMMENT '大图',
`sys_logo2` varchar(65) CHARACTER SET utf8 DEFAULT NULL COMMENT '小图',
`sys_num` varchar(60) DEFAULT NULL,
`created` int(11) NOT NULL COMMENT '创建时间',
`updated` int(11) NOT NULL COMMENT '更新时间',
`deleted` enum('1','0') NOT NULL DEFAULT '0' COMMENT '冻结',
`parent_id` int(11) DEFAULT '0' COMMENT '系统父ID',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=53 DEFAULT CHARSET=latin1";
preg_match_all("/(`.+`)(.+)('.+'),/i",$sql,$out);
echo '
';
print_r($out);
}//
public function create_database_doc()
{
// /*
header("Content-Type: application/msword;charset=gbk");
header("Content-Disposition: attachment; filename=doc.doc");
header("Pragma: no-cache");
header("Expires: 0");
// */
$sql_query = "show tables;";
$query = $this->db->query($sql_query);
$rowset = $query->result_array();
$tablearrs = array();
foreach($rowset as $key => $value)
{
$sql_query = "desc ". $value['Tables_in_ka'];
// echo $sql_query;
$query = $this->db->query($sql_query);
$reset = $query->result_array();
$this->get_notes($value['Tables_in_ka'], $reset);
$tablearrs[$key]['tab_name'] = $value['Tables_in_ka'];
$tablearrs[$key]['feild_info'] = $reset;
}
$output ='';
foreach ($tablearrs as $key => $value)
{
$output .= '表'.$tablearrs[$key]['tab_name'].PHP_EOL;
$output .= '
Field | 'Type | 'Null | 'Key | 'Default | 'Extra | 'notes |
'.$val['Field'].' | ''.$val['Type'].' | ''.$val['Null'].' | ''.$val['Key'].' | ''.$val['Default'].' | ''.$val['Extra'].' | ''.$val['notes'].' |
我们提供的服务有:成都网站设计、成都网站制作、微信公众号开发、网站优化、网站认证、合作ssl等。为1000多家企事业单位解决了网站和推广的问题。提供周到的售前咨询和贴心的售后服务,是有科学管理、有技术的合作网站制作公司
//----------------------------------------------------------------------------------------
/**
* 生成MySQL数据字典
*/
header ( "Content-type: text/html; charset=utf-8" );
// 配置数据库
$dbserver = "localhost";
$dbusername = "root";
$dbpassword = "123";
$database = "db153";
// 其他配置
$title = '数据字典';
$mysql_conn = @mysql_connect ( "$dbserver", "$dbusername", "$dbpassword" ) or die ( "Mysql connect is error." );
mysql_select_db ( $database, $mysql_conn );
mysql_query ( 'SET NAMES utf8', $mysql_conn );
$table_result = mysql_query ( 'show tables', $mysql_conn );
// 取得所有的表名
while ( $row = mysql_fetch_array ( $table_result ) ) {
$tables [] ['TABLE_NAME'] = $row [0];
}
// 循环取得所有表的备注及表中列消息
foreach ( $tables as $k => $v ) {
$sql = 'SELECT * FROM ';
$sql .= 'INFORMATION_SCHEMA.TABLES ';
$sql .= 'WHERE ';
$sql .= "table_name = '{$v['TABLE_NAME']}' AND table_schema = '{$database}'";
//echo $sql.'
';
$table_result = mysql_query ( $sql, $mysql_conn );
while ( $t = mysql_fetch_array ( $table_result ) ) {
$tables [$k] ['TABLE_COMMENT'] = $t ['TABLE_COMMENT'];
}
$sql = 'SELECT * FROM ';
$sql .= 'INFORMATION_SCHEMA.COLUMNS ';
$sql .= 'WHERE ';
$sql .= "table_name = '{$v['TABLE_NAME']}' AND table_schema = '{$database}'";
$fields = array ();
//echo $sql.'
';
$field_result = mysql_query ( $sql, $mysql_conn );
while ( $t = mysql_fetch_array ( $field_result ) ) {
$fields [] = $t;
}
$tables [$k] ['COLUMN'] = $fields;
}
mysql_close ( $mysql_conn );
$html = '';
// 循环所有表
foreach ( $tables as $k => $v ) {
// $html .= '
字段名 | 数据类型 | 默认值 | 允许非空 | 自动递增 | 备注 |
---|---|---|---|---|---|
' . $f ['COLUMN_NAME'] . ' | ';' . $f ['COLUMN_TYPE'] . ' | ';' . $f ['COLUMN_DEFAULT'] . ' | ';' . $f ['IS_NULLABLE'] . ' | ';' . ($f ['EXTRA'] == 'auto_increment' ? '是' : ' ') . ' | ';' . $f ['COLUMN_COMMENT'] . ' | ';
mysqli
/**
* 生成mysql数据字典
*/
header ( "Content-type: text/html; charset=utf-8" );
// 配置数据库
$dbserver = "192.168.5.220";
$dbusername = "root";
$dbpassword = "root";
$database = "card";
// 其他配置
$title = '数据字典';
$mysql_conn = new mysqli( "$dbserver", "$dbusername", "$dbpassword","$database" ) ;
$mysql_conn->query ( 'SET NAMES utf8' );
$table_result = $mysql_conn->query ( 'show tables' );
// 取得所有的表名
while ( $row = $table_result->fetch_array ( ) ) {
$tables [] ['TABLE_NAME'] = $row [0];
}
// 循环取得所有表的备注及表中列消息
foreach ( $tables as $k => $v ) {
$sql = 'SELECT * FROM ';
$sql .= 'INFORMATION_SCHEMA.TABLES ';
$sql .= 'WHERE ';
$sql .= "table_name = '{$v['TABLE_NAME']}' AND table_schema = '{$database}'";
//echo $sql.'
';
$table_result = $mysql_conn->query ( $sql );
while ( $t = $table_result->fetch_array ( ) ) {
$tables [$k] ['TABLE_COMMENT'] = $t ['TABLE_COMMENT'];
}
$sql = 'SELECT * FROM ';
$sql .= 'INFORMATION_SCHEMA.COLUMNS ';
$sql .= 'WHERE ';
$sql .= "table_name = '{$v['TABLE_NAME']}' AND table_schema = '{$database}'";
$fields = array ();
//echo $sql.'
';
$field_result = $mysql_conn->query ( $sql );
while ( $t = $field_result->fetch_array ( ) ) {
$fields [] = $t;
}
$tables [$k] ['COLUMN'] = $fields;
}
$mysql_conn->close();;
$html = '';
// 循环所有表
foreach ( $tables as $k => $v ) {
// $html .= '
$html .= '
字段名 | 数据类型 | 默认值 | 允许非空 | 自动递增 | 备注 |
---|---|---|---|---|---|
' . $f ['COLUMN_NAME'] . ' | ';' . $f ['COLUMN_TYPE'] . ' | ';' . $f ['COLUMN_DEFAULT'] . ' | ';' . $f ['IS_NULLABLE'] . ' | ';' . ($f ['EXTRA'] == 'auto_increment' ? '是' : ' ') . ' | ';' . $f ['COLUMN_COMMENT'] . ' | ';
}
// 输出
echo '
body,td,th {font-family:"宋体"; font-size:12px;}
table{border-collapse:collapse;border:1px solid #CCC;background:#6089D4;}
table caption{text-align:left; background-color:#fff; line-height:2em; font-size:14px; font-weight:bold; }
table th{text-align:left; font-weight:bold;height:26px; line-height:25px; font-size:16px; border:3px solid #fff; color:#ffffff; padding:5px;}
table td{height:25px; font-size:12px; border:3px solid #fff; background-color:#f0f0f0; padding:5px;}
.c1{ width: 150px;}
.c2{ width: 130px;}
.c3{ width: 70px;}
.c4{ width: 80px;}
.c5{ width: 80px;}
.c6{ width: 300px;}
';echo '
echo $html;
echo '';
?>