【发布时间】:2016-08-12 05:52:34
【问题描述】:
我在我的网站的私人部分做了一个功能,以获取和显示存储库的一些文件。
下面是我做的功能:
function getFilesChantier($devis, $cp) {
// Si dossier cp n'existe pas on le créé
if (!file_exists(_DOCS_ . 'C' . $cp)) {
mkdir(_DOCS_ . 'C' . $cp, 0777, true);
fopen(_DOCS_ . 'C' . $cp . '/index.html', w);
}
if (!file_exists(_DOCS_ . 'C' . $cp . '/' . $devis)) {
mkdir(_DOCS_ . 'C' . $cp . '/' . $devis, 0777, true);
fopen(_DOCS_ . 'C' . $cp . '/' . $devis . '/index.html', w);
}
//On liste les fichiers pdf
$repertoire = _DOCS_ . 'C' . $cp . '/' . $devis;
if ($dossier = opendir($repertoire)) {
while (false !== ($fichier = readdir($dossier))) {
if ($fichier != '.' && $fichier != '..' && $fichier != 'index.php' && $fichier != 'index.html' && $fichier != 'Thumbs.db') {
$nb_fichier++; // On incrémente le compteur de 1
$retour[$nb_fichier]['name_file'] = str_replace('/var/www/sp-batiment.com/htdocs/docs/C' . $cp . '/' . $devis . '/', '', $repertoire . '/' . $fichier);
$retour[$nb_fichier]['url_file'] = str_replace('/var/www/sp-batiment.com/htdocs/', '', $repertoire . '/' . $fichier);
$retour[$nb_fichier]['nb_file'] = $nb_fichier;
$retour[$nb_fichier]['date_file'] = date("F d Y H:i:s.", filectime($repertoire . '/' . $fichier));
}
}
}
return $retour;
}
在所有浏览器中都可以正常工作。
下面是我的网站效果图:
但是当我们使用手机(Android Samsung)时,它无法在 Google Chrome 浏览器上运行,它什么也不显示。
我不知道是我的功能出了什么问题,还是它正在拨打电话?
调用的页面是一样的,只是浏览器变了(第一个是电脑上的经典谷歌浏览器),另一个是三星Galaxy和谷歌浏览器。
编辑
我用的是 Bootstrap,下面是我的表的代码:
<div class="col-md-12">
<h3>Mes documents</h3>
<table class="table table-bordered">
<thead>
<tr>
<th>#</th>
<th><i class="fa fa-calendar"></i> Date</th>
<th class="text-center">Type</th>
<th>Fichier</th>
<th>Options</th>
</tr>
</thead>
<tbody>
<tr>
<td nowrap="">1</td>
<td nowrap="">17-08-2016 </td>
<td nowrap="" class="text-center"><span class="label label-danger" style="text-transform:uppercase;tex-align:left"><i class="fa fa-file-pdf-o"></i></span></td>
<td nowrap=""> compément-de-devis-1.pdf</td>
<td nowrap="">
<form action="php/download.php" method="post">
<button class="btn btn-dark btn-xs"><i class="fa fa-cloud-download"></i> Télécharger</button>
</form>
</td>
</tr>
<tr>
<td nowrap="">2</td>
<td nowrap="">04-08-2016 </td>
<td nowrap="" class="text-center"><span class="label label-danger" style="text-transform:uppercase;tex-align:left"><i class="fa fa-file-pdf-o"></i></span></td>
<td nowrap=""> autorisation-changement-de-façade.pdf</td>
<td nowrap="">
<form action="php/download.php" method="post">
<button class="btn btn-dark btn-xs"><i class="fa fa-cloud-download"></i> Télécharger</button>
</form>
</td>
</tr>
<tr>
<td nowrap="">3</td>
<td nowrap="">03-08-2016 </td>
<td nowrap="" class="text-center"><span class="label label-danger" style="text-transform:uppercase;tex-align:left"><i class="fa fa-file-pdf-o"></i></span></td>
<td nowrap=""> devis-initial.pdf</td>
<td nowrap="">
<form action="php/download.php" method="post">
<button class="btn btn-dark btn-xs"><i class="fa fa-cloud-download"></i> Télécharger</button>
</form>
</td>
</tr>
<tr>
<td nowrap="">4</td>
<td nowrap="">03-08-2016 </td>
<td nowrap="" class="text-center"><span class="label label-danger" style="text-transform:uppercase;tex-align:left"><i class="fa fa-file-pdf-o"></i></span></td>
<td nowrap=""> plan-du-batiment.pdf</td>
<td nowrap="">
<form action="php/download.php" method="post">
<button class="btn btn-dark btn-xs"><i class="fa fa-cloud-download"></i> Télécharger</button>
</form>
</td>
</tr>
<tr>
<td nowrap="">5</td>
<td nowrap="">03-08-2016 </td>
<td nowrap="" class="text-center"><span class="label label-danger" style="text-transform:uppercase;tex-align:left"><i class="fa fa-file-pdf-o"></i></span></td>
<td nowrap=""> facture-acompte-n-1.pdf</td>
<td nowrap="">
<form action="php/download.php" method="post">
<button class="btn btn-dark btn-xs"><i class="fa fa-cloud-download"></i> Télécharger</button>
</form>
</td>
</tr>
</tbody>
</table>
</div>
【问题讨论】:
-
可以提供html吗?您是否正在使用一些响应式布局(例如引导程序?)如果不查看您的 html,将很难提供帮助。我的猜测是,您的 html 中有一些类可以隐藏表格中的数据,以便在小宽度浏览器(手机)中可见
-
是的,我确实使用引导程序,我将使用代码进行更新。感谢您的快速回复
-
@StanislasPiotrowski 你能用你的 HTML 更新你的问题吗?
-
Bootstrap 很可能会为您隐藏表格行,因为它在该屏幕尺寸下会很乱。您可能想看看No More Tables 让表格在小屏幕上工作的方法。
-
尝试在网络浏览器上更改窗口大小,看看会发生什么。 Bootstrap 有多个表选项,您使用的是哪个?除非您提供您的 html,否则您的赏金将得不到任何答案,因为没有人能够正确回答。
标签: php android google-chrome fopen getfiles