我已经在网上查看了这个错误,它主要是说你缺少一个分号,但我找不到任何缺少的分号我希望你们能帮助我。
<?php // add_file.php
require 'log.php';
require 'dictionary.php';
function add_file($file = $_FILES["file"], $tags = $_POST["tags"] ){ // Parse error: syntax error, unexpected T_VARIABLE
$tags = explode(",", $tags);
if ($file["error"]>0){
log("add_file", "Error in file: ".$file["error"], "error");
exit();
} else {
$file["deleted"] = false;
$file["tags"] = $tags;
$file["id"] = uniqid();
$file["ext"] = pathinfo($file['name'], PATHINFO_EXTENSION);
$file["name"] = pathinfo($file['name'], PATHINFO_FILENAME);
$file["tags"][] = $file["ext"];
$file["tags"][] = $file["type"];
$file["tags"][] = explode("/", $file["type"])[0];
$file["date_created"] = date(DateTime::ATOM);
if (file_exists("files/" . $file["id"].".".$file['ext'])){
$file["id"] = uniqid();
$file["loc"] = "files/" . $file["id"].".".$file['ext'];
move_uploaded_file($file["tmp_name"], $file["loc"]);
log("add_file", "Added file at: ".$file["loc"]);
} else {
$file["loc"] = "files/" . $file["id"].".".$file['ext'];
move_uploaded_file($file["tmp_name"], $file["loc"]);
log("add_file", "Added file at: ".$file["loc"]);
}
dict_add("dictionary.json", $file);
}
}
?>