我有一个PHP文件函数,在代码的某个时刻,它开始将所有内容都回显到屏幕上,但代码仍然有效。
起初我认为回声没有被正确地关闭,但事实似乎是这样,即使我注释掉回声,它仍然会将其打印到屏幕上。
下面是代码开始显示的位置附近的代码示例。
$conn = mysql_connect('localhost', 'root', ''); //Details to connect to the specific database and table, password is left blank
mysql_select_db('amazondb', $conn); //mysql command to pick the specific database and runs the connection
//Clear data from Table
mysql_query ("TRUNCATE TABLE imported_orders2"); //Runs mysql query to delete all data in the specified table
//Informs User
//echo "<br>Uploaded File: <br>"; //Tells the user the name of the file they have uploaded
//echo "<br>Uploaded File: " . $_FILES["file"]["name"] . "<br>"; //Tells the user the name of the file they have uploaded
//Move uploaded file
move_uploaded_file($_FILES["file"]["tmp_name"], "upload/" . $_FILES["file"]["name"]); //When the file is first uploaded it is saved in a temporary location and only exists while the php is running, this moves the file to a specific folder permanently
//Delete first Line
这里有一个链接,指向显示的屏幕截图,我强调了一切似乎都一团糟的地方。
检查您的PHP文件是否有正确的PHP Open标记和Close标记。
如果是,请检查您的PHP.INI文件是否有短打开标记是否打开,如果是关闭,请将您的PHP打开标记更改为或将您的PHPINI文件短打开标记改为打开。
我认为您在代码中使用$_FILES["File"]["Name"]
之前关闭了php标记。
您可以尝试更换
$_FILES["File"]["Name"]
通过
<?php echo $_FILES["File"]["Name"]; ?>
它会显示文件的名称。