以下是否将我的文件保存到当前文件夹或保存到文件中?因为我无法在任何地方找到该文件:
$name = $_POST['name'];
$email = $_POST['email'];
$first_time = $_POST['first_time'];
$num_visits = $_POST['num_visits'];
$recommend = $_POST['recommend'];
$all_favs = '';
foreach($_POST['favourites'] as $favourites) {
$all_favs = $all_favs . ' ' . $favourites . ',';
}
$quality = $_POST['quality'];
$presentation = $_POST['presentation'];
$service = $_POST['service'];
$cleanliness = $_POST['cleanliness'];
$speed = $_POST['speed'];
$comments = $_POST['comments'];
$vdate = $_POST['vdate'];
$method = $_POST['method'];
$from = $email;
$subject = 'New feedback from ' . $name . "";
//create CSV to mail
$filename="collect/" . $vdate . $email . ".csv"; //specify filename and path
$keys=array_keys($_POST); //get list of post keys
$file=fopen($filename,"w"); //open a csv file to write to;
fputcsv($file,$keys); //write post keys as first line of CSV file.
fputcsv($file,$_POST); //write post data as second line of csv file.
fclose($file); //close the file.
我在MacOS X上运行CF9。
答案 0 :(得分:4)
引用docs for cfdump
(writeDump
的标记变体):
文件名必须包含文件的完整路径名。您可以指定绝对路径或相对于ColdFusion临时目录的路径。您可以使用GetTempDirectory()函数来确定ColdFusion临时目录。
您的转储存储在(system&#;)temp目录中。如果要将其存储在脚本目录中,请使用:
something = doSomething();
dumpLocation = expandPath("results.html");
WriteDump(var=something, format='html', output=dumpLocation);