这就是我如何制作一个目录中的文件表,它们将是pdf或图像,我的第一个目标是获得一部分标题(我将按照我喜欢的方式分开number_nam_company_color.pdf
并且我必须将这些信息作为链接带到表中,当点击它们在窗口中打开时就像按钮一样,我不确定我是否以正确的方式获取这些文件。
<!DOCTYPE html>
<html>
<head>
<title>Aceuil</title>
<link href="https://fonts.googleapis.com/css?family=Lato:100" rel="stylesheet" type="text/css">
<link href="{{asset('css/style.css')}}" rel="stylesheet">
<script type="text/javascript" src="{{ URL::asset('js/jquery.js') }}"></script>
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<body>
<div >
<div >
<table class="grey">
<tbody>
<tr>
<th>number</th>
<th>nam</th>
<th>company</th>
<th>color</th>
<th>date</th>
</tr>
<tr>
<?php
$dirname = 'myfiles';
$dir = opendir($dirname);
while($file = readdir($dir)) {
if($file != '.' && $file != '..' && !is_dir($dirname.$file)) {
?>
<td>
<?php
echo '<a href="'.$dirname.'/'.$file.'">'.$file.'</a>';
?>
</td>
<td>
<?php
echo '<a href="'.$dirname.'/'.$file.'">'.$file.'</a>';
?>
</td>
<td>
<?php
echo '<a href="'.$dirname.'/'.$file.'">'.$file.'</a>';
?>
</td>
<td>
<?php
echo '<a href="'.$dirname.'/'.$file.'">'.$file.'</a>';
?>
</td>
<td>
<?php
echo "filectime($dirname . '/' . $file))";
?>
</td>
</tr>
<?php
}
}
closedir($dir);
?>
</div>
</div>
</body>
</html>
&#13;
答案 0 :(得分:0)
使用了这个:
$data = "$file";
list($numero,$nom,$marque,$couleur) = explode("_", $data);
echo '<a href="'.$dirname.'/'.$file.'">'.$numero.'</a>';//in the same way i can get anything i want from the title
echo '<a href="'.$dirname.'/'.$file.'">'.$nom.'</a>';
我想在不带chrome的窗口中打开那个pdf文件吗?