我想在服务器面板上创建一个.dat文件,并希望将该文件上传到服务器上的“ data_files”文件夹中。这是我创建的代码,
<?php
$a = "H";
$b = "Z01284001";
$c = " ";
$e = "20181122";
$d = " ";
$f = "E72402";
$k = " ";
$g = "Sabah Care Specialist CliLot 9, Lintas Jaya Uptown";
$l = " ";
$h = "PRN";
$m = " ";
$n = "D";
$o = "EPFLX20";
$p = " ";
$q = "S";
$r = " ";
$s = "000002780000020000000000000";
$t = " ";
$u = "T";
$v = " ";
$file = fopen("/abc/ced/dat_files/testing.dat","w");
fwrite($file,"$a$b$c$e$d$f$k$g$l$h$m\n$n$o$p$q$r$s$t\n$u$v");
fclose($file);
echo "File created successfully!";
?>
请帮帮我。
答案 0 :(得分:0)
if (!is_dir("dat_files")) {
mkdir("dat_files");
}
假设您当前的用户对当前文件夹具有写权限。