我有这个 jquery 代码:
var myarr = ["aa","ss","dd"];
$.ajax({
url: "proces.php",
data: "arr="+myarr,
type: "POST",
success: function () {
alert("data is send");
}
});
我看到消息data is send
,但在proces.php
文件中我有这个代码
$str = '';
foreach ($_POST['arr'] as $k=>$v) {
$str = $str.$v;
}
$hand = fopen("t.txt","w+");
fwrite($hand,$str);
在文件中t.txt
没有写任何内容,请告诉我哪里错了?