所以代码看起来像这样:
<script>
function createFolder(folder){
$.ajax({
url: "index.php",
type: "POST",
data: {'folder':folder},
success: function(data) {
console.log("successful post");
}
});
}
</script>
<?php
if(isset($_POST["folder"])){
$folder = $_POST["folder"];
if(!file_exists($folder)) {
mkdir($folder); <--- this code runs
echo '<script>alert("qwe")</script>'; <--- this code doesnt run
}
else {
echo '<script>alert("qwer")</script>'; <--- this code doesnt run
}
echo '<script>alert("qwert")</script>'; <--- this code doesnt run
}
echo '<script>alert("qwerty")</script>'; <--- this code runs
?>
..所以在我检查文件存在的 if 语句中,echo 不起作用,但 mkdir($folder) 命令成功运行,这对我来说有点困惑。为什么 echo 在 if 语句中不起作用?
精慕HU
富国沪深