PHP语法检查:解析错误:语法错误?

我使用我的PHP代码时出现此错误

PHP语法检查:解析错误:语法错误,在第7行代码中出现意外的'}'

请帮助我,我不明白什么是做错了这里的PHP代码:

<?php


if ( $ready == "false" ) { 
$rand =  chr(rand(97, 122)). chr(rand(97, 122)). chr(rand(97, 122)); 
$folder = "uploads/".$rand 
}

if ( !is_dir($folder) ) {
    $ready = "true"
}
if ( is_dir($folder) ) {
    $ready = "false"
}

if ( $ready == "true" ) {
$that = "yes"
mkdir("uploads/".$rand);
$to = "Uploads/".$_FILES["file"]["name"];
move_uploaded_file($_FILES["file"]["tmp_name"], $to);
echo "uploaded";
}
?>


<form method="post" enctype="multipart/form-data">
<label>Choose a file:</label>
<input type="hidden" name="upload" value="1">
<input type="file" name="file">
<input type="submit" value="upload" onclick="$other = "yes""/>

</form>

你错过了; 在许多行中完成代码:

if ( $ready == "false" ) { 
  $rand =  chr(rand(97, 122)). chr(rand(97, 122)). chr(rand(97, 122)); 
  $folder = "uploads/".$rand ;
}

if ( !is_dir($folder) ) {
    $ready = "true";
}
if ( is_dir($folder) ) {
    $ready = "false";
}

if ( $ready == "true" ) {
  $that = "yes";
  mkdir("uploads/".$rand);
  $to = "uploads/".$_FILES["file"]["name"];
  move_uploaded_file($_FILES["file"]["tmp_name"], $to);
  echo "uploaded";
}

您在第7行的末尾忘了分号。该语句不完整,因此解析器不会期望大括号。

if ( $ready == "false" ) { 
    $rand =  chr(rand(97, 122)). chr(rand(97, 122)). chr(rand(97, 122)); 
    $folder = "uploads/".$rand ;
}
链接地址: http://www.djcxy.com/p/69885.html

上一篇: PHP Syntax Check: Parse error: syntax error?

下一篇: PHP Error: Unable to jump to row 0 on MySQL