我正在浏览http://net.tutsplus.com/tutorials/php/online-file-storage-with-php/comment-page-2/#comments上的教程 ,它工作正常,直到:
if(strlen($message) > 0)
{
$message = '<p class="error">' . $message . '</p>';
}
这行 php 在 index.php 中找到。当我在 Firefox 中查看页面时,看起来 php 解析器停止在大于。我可以逃脱角色吗?我需要吗?
编辑:所有的php代码:
<?php
//Load the settings
require_once("settings.php");
$message = "";
//Has the user uploaded something?
if(isset($_FILES['file']))
{
$target_path = Settings::$uploadFolder;
$target_path = $target_path . time() . '_' . basename( $_FILES['file']['name']);
//Check the password to verify legal upload
if($_POST['password'] != Settings::$password)
{
$message = "Invalid Password!";
}
else
{
//Try to move the uploaded file into the designated folder
if(move_uploaded_file($_FILES['file']['tmp_name'], $target_path)) {
$message = "The file ". basename( $_FILES['file']['name']).
" has been uploaded";
} else{
$message = "There was an error uploading the file, please try again!";
}
}
//Clear the array
unset($_FILES['file']);
}
if(strlen($message) > 0)
{
$message = '<p class="error">' . $message . '</p>';
}
?>
<html> ... </html> //my html code