我正在使用HTML表單上傳文件。然後我使用文件數組將它們轉換爲變量,然後我試圖讀取這個變量。我想從txt文件中讀取數據,但是file_get_contents拒絕讀取uaing數組,因此我如何讀取它我的代碼在這裏
我的代碼是在這裏:
if(isset($_POST['upload'])) {
$image = $_FILES['sfile'];
$contents = file_get_contents($image);
$links = explode(',',$contents);
echo $links[0];
}
它從下面的表格
<html>
<head>
<title> Trial </title>
</head>
<body>
<form align="center" method="post" action="example.php" enctype="multipart/form-data">
Upload File Here : <input type="file" name="sfile"><br>
<input type="submit" name ="upload" value="Upload">
</form>
</body>
</html>
小心顯示代碼的輸入,比如$ _FILES ['sfile']是什麼? 什麼是輸出/錯誤? –
–
輸出說的file_get_contents需要代替陣列 –