如何使用PHP下载文件 [英] How do I Download a file using PHP
问题描述
大家好我有一个小脚本
在数据库中搜索记录
我的数据库有几列
Id, FirstName,Lastname和Filepath。
当我为数据库中的每条记录执行一个querry时,该人应该有一个类型为.docx的文件,文件存储在本地服务器/ htdocs /和filepath中每个人都保存在这一栏中。
当我打开浏览器并搜索此人时,带有filepath的最后一列必须为每条记录打开此文件。
这是一个例子。
Hello guys I had a small script
which is searching in a database for records
and my database has couple columns
Id,FirstName,Lastname, and Filepath.
When I execute a querry for each record in the database the person should have 1 file with type .docx the files are stored on the local server /htdocs/ and filepath for each person is saved in this column.
When I open browser and search for this person the last column with filepath must open this file for each record.
Here is an example.
<?php
if (mysql_num_rows($sql_result)>0) {
while ($row = mysql_fetch_assoc($sql_result)) {
<tr>
<td> echo $row["id"]; </td>
<td> echo $row["firstname"]; </td>
<td> echo $row["lastname"]; </td>
<td> echo $row["file_path"];' ?></td>
</tr>
?>
在此先感谢任何帮助!
Thanks in advance any help appreciated!
推荐答案
sql_result)> 0){
while (
sql_result)>0) { while (
row = mysql_fetch_assoc(
row = mysql_fetch_assoc(
sql_result)){
< tr >
< td > echo
sql_result)) { <tr> <td> echo
这篇关于如何使用PHP下载文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!