douyu9433 2019-06-22 04:47
浏览 83

多个txt文件的分页

I hope you can help me with a problem that I do not know how to solve.

It turns out that I have a database of telephone numbers in a txt file, as this file weighs almost 2GB, I decided to split them into files with about 20,000 lines, generating 5000 txt files in this way.

I would need to include them using an include within a div in the following way

<php include "file1.txt"; ?>

the problem is that I would have to do this task 5000 times, generating another 4999 php files to include within a div.

It occurs to me then, to do something so that I take all the txt files of a certain directory, the pages and load them into the div when I click on the paginated link.

Try a code that I found as the following  

<? php $ folder = "arg /";
$ files = scandir ($ folder);

if (isset ($ _ GET ['alpha'])) && strlen ($ _ GET ['alpha']) == 1) {
    foreach ($ files as $ file) {
        $ reg = '/ ^'. $ _GET ['alpha']. '. * \. php $ / i';

        if (preg_match ($ reg, $ file)) {
            echo '<a href="'.$folder.$file.'">'. $ file. ;
        }
    }
}
?>

But I do not work the absolute, could you give me a little hand please?

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 求解O-S方程的特征值问题给出边界层布拉休斯平行流的中性曲线
    • ¥15 谁有desed数据集呀
    • ¥20 手写数字识别运行c仿真时,程序报错错误代码sim211-100
    • ¥15 关于#hadoop#的问题
    • ¥15 (标签-Python|关键词-socket)
    • ¥15 keil里为什么main.c定义的函数在it.c调用不了
    • ¥50 切换TabTip键盘的输入法
    • ¥15 可否在不同线程中调用封装数据库操作的类
    • ¥15 微带串馈天线阵列每个阵元宽度计算
    • ¥15 keil的map文件中Image component sizes各项意思