ThinkPHP uses pclzip to package and back up the mysql database, thinkphppclzip. ThinkPHP uses pclzip to package and back up a mysql database. thinkphppclzip describes how thinkPHP uses pclzip to package and back up a mysql database. For your reference, thinkPHP uses pclzip to package and back up mysql databases. thinkphppclzip
This example describes how thinkPHP uses pclzip to package and back up mysql databases. We will share this with you for your reference. The details are as follows:
PclZip introduces how to compress and decompress Zip files (WinZip and PKZIP) in the PclZip library and process such files, this includes generating compressed files, listing compressed files, and extracting files.
Database Backup is a very important thing. many backup methods also use vps for direct backup, and some use phpmyadmin for data backup. The small editor thinks this is troublesome and the backed up SQL file is too large to occupy a certain amount of space. Therefore, using pclzip to compress SQL files saves some space. Before Xiaobian has written database backup code here will not repeat, Pclzip official: http://www.phpconcept.net/pclzip/pclzip-downloads (the latest version of 2-8-2 ).
This site.
Find file_put_contents in the DatabaseAction. class. php file and add the following code below:
Import ("ORG. util. pclZip "); $ archive = new PclZip ('. /data /'. date ("y-m-d" ).'.zip '); $ v_list = $ archive-> create ($ dir); if (file_exists ($ dir) & $ v_list! = 0) {$ this-> success ("backup succeeded & compressed");} else {die ("Error :". $ archive-> errorInfo (true); $ this-> error ("backup failed ");}
And delete the original DatabaseAction. class. php if.