以下是我現在的總代碼。我已經逃過了反斜槓,做了我認爲應該是正確的一切。mysqldump生成空文件
<?php
include('conn.php');
mysql_select_db("landshop_formdata");
$dbname="landshop_clientdata";
$dbhost="localhost";
$dbuser="landshop_anitgop";
$dbpass="password";
//$root = realpath($_SERVER["DOCUMENT_ROOT"]);
$backupFile =$dbname.".sql";
echo $backupFile."<br><br>";
//$dmp="C:\\Program Files\\EasyPHP-5.3.8.1\\mysql\\bin\\mysqldump.exe";
//$command = "$dmp --OPT -h$dbhost -u$dbuser -p$dbpass $dbname > $backupFile";
//system($command);
$dmp = '"C:\Program Files\EasyPHP-5.3.8.1\mysql\bin\mysqldump.exe"';
$command = $dmp
. ' --opt -h '.$dbhost.' -u "'. $dbuser. '" -p "'. $dbpass.'" '. $dbname.' > "'. $backupFile. '"';
system($command);
?>
它還在生成0kb文件!怎麼了 ?!我試過所有選項!
您忘記[逃避反斜槓](http://www.php.net/manual/en/language.types.string.php#language.types.string.syntax.double) – fvu
在'$ dbhost'和'$ dbuser'從一個空格開始? – air4x
@fvu,你能解釋一下嗎? – user1407430