PHP - 创建备份路径

时间:2018-03-01 18:44:44

标签: php mysql

我想创建MySQL备份

此代码工作正常

$folder = 'C:\Users\Najva\Desktop\backup/';
if(!is_dir($folder))
mkdir($folder, 0777, true);
chmod($folder, 0777);

$backup_file_name =$folder. $database. "_". date( "d-m-Y--h-i-s"); // Create Backup File NAme
$handle = fopen($backup_file_name .'backup.sql', 'w+');

fwrite($handle, $return);
fclose($handle);
echo "success"; 

但我真的想要这样

$pathfoder = $_POST['value'] ; // Same Link C:\Users\Najva\Desktop\backup/
$folder = $pathfolder;
if(!is_dir($folder))
mkdir($folder, 0777, true);
chmod($folder, 0777);

$backup_file_name =$folder. $database. "_". date( "d-m-Y--h-i-s"); // Create Backup File NAme
$handle = fopen($backup_file_name .'backup.sql', 'w+');

fwrite($handle, $return);
fclose($handle);
echo "success";

显示错误

警告:mkdir():第61行的C:\ wamp \ www \ dbbackupmaster \ new.php中的路径无效

警告:chmod():第62行的C:\ wamp \ www \ dbbackupmaster \ new.php中的参数无效

0 个答案:

没有答案