每次尝试使用upload时都会收到此错误.php。(我想为文件名是用户名的图像制作更新)
Parse error: syntax error, unexpected 'width' (T_STRING), expecting ',' or ';' in
D:[...]upload.php on line 24
上传.php:
<?php
include('auth.php');
include 'dbconnection.php';
$user= "1";
$id=($_SESSION['logedin']);
$abfrage = "SELECT * FROM login WHERE id = '$id'";
$ergebnis = mysql_query($abfrage);
while($row = mysql_fetch_object($ergebnis))
{
$user= (".$row->id.") ;
}
move_uploaded_file($_FILES['image']['tmp_name'], './images/'.$user.'jpg');
?>
<!DOCTYPE html>
<html>
<head></head>
<body>
<?php
echo "<img style="width: 250px; height: 500px" src="'./images/'.$user.'jpg''?v='.rand(0,1000)"/>"
?>
</body>
</html>
以下是我如何使用上传.php:
<form method="post" action="upload.php" enctype="multipart/form-data" target="leiframe">
<input type="file" name="image"/>
<input type="submit" value="upload"/>
</form>
echo "<img style="width: 250px; height: 500px" src="'./images/'.$user.'jpg''?v='.rand(0,1000)"/>"
需要
echo '<img style="width: 250px; height: 500px" src="./images/'.$user.'jpg?v='.rand(0,1000).'"/>';