答案 0 :(得分:0)
从SQL获取文本文件名,然后使用file_get_contents()获取文本文件内容。
$servername = "localhost";
$username = "username";
$password = "password";
$dbname = "myDB";
// Create connection
$connection= new mysqli($servername, $username, $password, $dbname);
$query = mysqli_query($connection, "SELECT name FROM new_record");
while ($row = mysqli_fetch_array($query)) {
$fileName = $row['name'];
$fileContents = file_get_contents("/TXT/$fileName");
echo $fileContents;
}