如何使用php本机功能和Android获取文件

栏目: PHP · 发布时间: 5年前

内容简介:在您的html代码中,没有问题,因为我在我的移动设备上运行它的工作正常.一个小的错字错误tex对齐到您的代码中的文本错误您可以通过您的PC检查您的移动谷歌Chrome浏览器中的HTML代码.检查这个链接

我在我的网站的私人部分做了一个功能,以获取和显示一个存储库的一些文件.

以下是我做的功能:

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;
    }

所有浏览器都可以正常工作,

以下是我网站的呈现

如何使用 <a href='https://www.codercto.com/topics/18749.html'>php</a> 本机功能和Android获取文件

但是当我们转向手机(Android Samsung)时,它不适用于谷歌Chrome浏览器,

它什么都不显示

如何使用php本机功能和Android获取文件

我不知道我的功能有什么问题,还是它正在打电话的事实?

调用的页面是一样的,只是浏览器改变(第一个是电脑上的经典的谷歌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代码中,没有问题,因为我在我的移动设备上运行它的工作正常.

一个小的错字错误tex对齐到您的代码中的文本错误

您可以通过您的PC检查您的移动谷歌Chrome浏览器中的HTML代码.检查这个链接

https://developers.google.com/web/tools/chrome-devtools/debug/remote-debugging/remote-debugging?hl=en

从那里你可以检查表行是从你的PHP代码充气还是你的html代码有任何问题

希望这将有所帮助

代码日志版权声明:

翻译自:http://stackoverflow.com/questions/38910837/how-to-get-file-using-php-native-functions-and-android


以上就是本文的全部内容,希望本文的内容对大家的学习或者工作能带来一定的帮助,也希望大家多多支持 码农网

查看所有标签

猜你喜欢:

本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们

Visual C++/Turbo C串口通信编程实践

Visual C++/Turbo C串口通信编程实践

熊光明 / 电子工业出版社 / 2004-10 / 55.0

一起来看看 《Visual C++/Turbo C串口通信编程实践》 这本书的介绍吧!

图片转BASE64编码
图片转BASE64编码

在线图片转Base64编码工具

HTML 编码/解码
HTML 编码/解码

HTML 编码/解码

HSV CMYK 转换工具
HSV CMYK 转换工具

HSV CMYK互换工具