有人可以解释一下这段代码吗,我正在读一本推荐给我的好书,我输入的代码与书中的完全一致。它显示代码而不是out,我不确定是什么问题,代码来自一本名为php solutions的书
<?php
// set the max upload size in bytes
$max = 51200;
if(isset($_POST['upload'])){
// define the path to the upload folder
$destination = 'C:\upload_test';
// move the file to the uplaod folder and rename it
move_uploaded_file($_FILES['image']
['tmp_name'], $destination.$_FILES['image']['setara']);
}
?>
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Mult</title>
<link rel="stylesheet" type="text/css" href="css/style.css">
</head>
<body>
<form action="" method="post" enctype="mutipar/form-data" id="uploadImage">
<p>
<label for="image">Upload image:</label>
<input type="hidden"name="MAX_FILE_SIZE" value="<?php echo $max; ?>">
<input type="file" name="image" id="image">
</p>
<p>
<input type="submit" name="upload" id="upload" value="Upload">
</p>
</form>
</body>
</html>
答案 0 :(得分:2)
这肯定是因为您在.html或.htm扩展文件中编写PHP代码尝试使用.php扩展文件放置代码。它将解决错误。