我目前正在使用Drupal7进行开发。
我的客户将把PDF上传到一个在线文件夹中。我需要链接,以自动填充在一个内容页面的基础上是什么文件夹。
因此,如果文件夹中有5个PDF,Drupal将自动显示5个指向PDF的唯一下载链接。谢谢你的帮助。
发布于 2012-09-18 04:16:53
我找到了一个解决方案。
<?php
if ($handle = opendir('/path/to/uploaded_files')) {
while (false !== ($file = readdir($handle))) {
if (substr($file,0,1) == ".") continue;
if (is_dir($file)) continue;
if (substr($file,-3,3) != "pdf") continue;
echo '<a href="';
echo $file;
echo '" target="_blank">';
echo $file;
echo '</a><br>';
}
closedir($handle);
}
?>https://stackoverflow.com/questions/12466225
复制相似问题