Closed vahidalvandi closed 4 years ago
You should be able to php://output
as output file to send contents directly to browser.
You may need to send Content-Disposition: attachment; filename="dump.sql"
header to trigger download.
please show me with this code
<?php
use Ifsnop\Mysqldump as IMysqldump;
try {
$dump = new IMysqldump\Mysqldump('mysql:host=localhost;dbname=testdb', 'username', 'password');
$dump->start('storage/work/dump.sql');
} catch (\Exception $e) {
echo 'mysqldump-php error: ' . $e->getMessage();
}
use Ifsnop\Mysqldump as IMysqldump;
header('Content-Type: text/plain;charset=utf-8');
header('Content-Disposition: attachment; filename="dump.sql"');
try {
$dump = new IMysqldump\Mysqldump('mysql:host=localhost;dbname=testdb', 'username', 'password');
$dump->start('php://output');
} catch (\Exception $e) {
echo 'mysqldump-php error: ' . $e->getMessage();
}
thank you
hi , please help me how i can dump file ?