该类库已经上传到GitHub和composer,可以composer一键安装。

GitHub地址:
https://github.com/lotofbadcode/phpextend

demo地址:
https://github.com/lotofbadcode/phpextenddemo

composer 地址
https://packagist.org/packages/lotofbadcode/phpextend

在线手册

https://www.kancloud.cn/lotofbadcode/php_spirit/content

快速上手:

备份数据库:

1.不使用AJAX

$backup = new \lotofbadcode\phpextend\databackup\mysql\Backup('127.0.0.1:3306', 'test', 'root', '');

$backup->setbackdir($backupdir) ->setvolsize(0.2);

do

{

$result = $backup->backup();

} while ($result['totalpercentage'] < 100);

2.使用AJAX备份(带进度条)

$backup = new \lotofbadcode\phpextend\databackup\mysql\Backup('127.0.0.1:3306', 'test', 'root', '');

$result = $backup->setbackdir($backupdir)

->setvolsize(0.2) //分卷大小

->ajaxbackup();

恢复数据库

1.不使用AJAX

$recovery = new \lotofbadcode\phpextend\databackup\mysql\Recovery('127.0.0.1:3306', 'test', 'root', '');

$recovery->setSqlfiledir(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'backup');

do

{

$result = $recovery->recovery();

} while ($result['totalpercentage'] < 100);

2.使用AJAX(带进度条)



$recovery = new \lotofbadcode\phpextend\databackup\mysql\Recovery('127.0.0.1:3306', 'test', 'root', '');

$result = $recovery->setSqlfiledir(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'backup')

->ajaxrecovery();

echo json_encode($result);

RoveCoder版权所有,转载请注明

猜你喜欢
picture loss