为什么 用xampp经常会出现“502 Bad Gateway ”提示?

502 Bad Gateway

PhpStorm 10.0.1

我是在学习“上传文件”一课时遇到的,用Google Chrome浏览器 windows平台,本来正常输出 echo啥的没问题,一执行“上传图片” 就出现,而且之后的所有php 还是 HTML 运行起来就是都这样,重启就又好了,但上传就不行。偶尔错误提示是404 bad Gateway。请大家指教!!感激不尽!!眼泪哗哗的!!

代码:

HTML:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>上传文件</title>
</head>
<body>
<form action="upload.php" method="post" enctype="multipart/form-data">
    <input type="file" name="myFile">
    <input type="submit" value="提交">
</form>
</body>
</html>

php:

<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>The Image</title>
</head>
<body>
<?php

$file=$_FILES['myFile'];
$fileName=$file['name'];
move_uploaded_file($file['tmp_name'],$fileName);

echo "<img src='$fileName'>";
?>
</body>
</html>
阅读 4.6k
撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题