【发布时间】:2020-12-07 03:38:56
【问题描述】:
所以代码看起来像这样:
<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
?>
..so 在我检查文件是否存在的 if 语句中,echo 不起作用,但是 mkdir($folder) 命令成功运行,这让我有点困惑。为什么 echo 在 if 语句中不起作用?
【问题讨论】:
-
其他警报是否有效?
标签: javascript php html if-statement echo