Home >Backend Development >PHP Tutorial >PHP script to export MySQL data dictionary (code example)

PHP script to export MySQL data dictionary (code example)

藏色散人
藏色散人forward
2020-01-31 19:54:013331browse

PHP script to export MySQL data dictionary (code example)

Tools

1.PHP environment: preferably PHP7, with the mysqli extension installed

2.nginx/Apache: This script can be accessed on the browser side

Function

1. Export html, you can choose whether to include the left directory

2. Export Word in html format, prompt for download

3.Support export of all tables and partial tables

4.Support regular expressions when exporting partial tables

Usage example

include('./DBdic.php');
//浏览器显示
DBdic::ini('localhost', 'db_name', 'username', 'password')->outForBrowser();
//浏览器显示, 带左侧菜单
DBdic::ini('localhost', 'db_name', 'username', 'password')->outForBrowserWithMenu();
//下载word文档
DBdic::ini('localhost', 'db_name', 'username', 'password')->outForWord();
//只导出一个表
DBdic::ini('localhost', 'db_name', 'username', 'password')->setExportTable('user')->outForBrowser();
//导出部分表, 支持正则
DBdic::ini('localhost', 'db_name', 'username', 'password')->setExportTableArray(['user', 'goods_.*', 'product_\d{4}'])->outForBrowser();

Source code download

Code Cloud Summer-Mysql-Dic(https://gitee.com/myDcool/PHP-DBDIC)

For more php related knowledge, please visit php tutorial!

The above is the detailed content of PHP script to export MySQL data dictionary (code example). For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:segmentfault.com. If there is any infringement, please contact admin@php.cn delete