Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- //Reference => https://github.com/gocom/danpu Or https://github.com/ifsnop/mysqldump-php
- //Export Code
- use Rah\Danpu\Dump;
- use Rah\Danpu\Export;
- try {
- $dump = new Dump;
- $dump
- ->file('/path/to/imported/file.sql')
- ->dsn('mysql:dbname=database;host=localhost')
- ->user('username')
- ->pass('password')
- ->tmp('/tmp');
- new Export($dump);
- } catch (\Exception $e) {
- echo 'Export failed with message: ' . $e->getMessage();
- }
- // Import Code
- use Rah\Danpu\Dump;
- use Rah\Danpu\Import;
- try {
- $dump = new Dump;
- $dump
- ->file('/path/to/imported/file.sql')
- ->dsn('mysql:dbname=database;host=localhost')
- ->user('username')
- ->pass('password')
- ->tmp('/tmp');
- new Import($dump);
- } catch (\Exception $e) {
- echo 'Import failed with message: ' . $e->getMessage();
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement