简体   繁体   English

如何在php中打印目录的链接?

[英]how can i print the link of a directory in php?

i ve a word document in my folder, whose name is already inserted in the database.. i want to show the document from the folder via php.. like if someone clicks on the link, the whole document should appear in front end .. 我在我的文件夹中有一个Word文档,其名称已经插入数据库中。.我想通过php从该文件夹中显示该文档。就像有人单击链接,整个文档应该出现在前端..

$sql = "SELECT * FROM user WHERE city LIKE '%".$term."%'"; 
$r_query = mysql_query($sql); 

while ($row = mysql_fetch_array($r_query)){  
echo 'fast name: ' .$row['fname'];  
echo '<br /> Resume : '.$row['resume']; 

This will only print the resume name stored in the db .. i want to represent the resume name as a link , after clicking on that it should show the whole document 这只会打印存储在数据库中的简历名称。我想将简历名称表示为链接,单击后它应该显示整个文档

As suggested you in comment, you need to put folder path in anchor tag. 如在注释中建议的那样,您需要将文件夹路径放在锚标记中。

$path = __DIR__ . "/../resume_folder/";
echo $path;

If $path is correct then write your code as below:- 如果$path是正确的,则编写如下代码:

while ($row = mysql_fetch_array($r_query)){  
  echo 'fast name: ' .$row['fname'];  
  echo "<a href='$path.{$row['resume']}'>Resume</a>";
}

Hope it will help you :) 希望它能对您有所帮助:)

这样尝试

echo '<br /> <a href = "<?php echo base_url().$row['resume'];?>"> Resume </a>'; 

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM