下载pdf文件,从用户名中查找

can help download pdf file, i have code:

<?php echo '<a href="path/'.$_SESSION['user'].'.pdf">dowload pdf</a>'; ?>

'User' is 548754, pdf file name is *548754*00_01215.pdf, how make download pdf file find by first 6 (six) number.

Thanks

If you would like to echo a link with the UserID in it, then add the rest of filename:

<?php echo '<a href="path/'.$_SESSION['user'].'00_01215.pdf">dowload pdf</a>'; ?>

However, if you want to find the PDF file(s) which begin with the user's ID, then do something like this:

<?php
$directory = opendir('./');
$userid = "548754";
  while ($file = readdir($directory)) {
    if($file!="." && $file!=".." && strpos($file,$userid) !== false){
      echo '<a href="'.$file.'">Download PDF</a><BR>';
    }
  }
closedir($directory);
?>