Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/89.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 如何加快网页的加载速度?_Php_Html - Fatal编程技术网

Php 如何加快网页的加载速度?

Php 如何加快网页的加载速度?,php,html,Php,Html,我的网页在调整时超过了300秒的最大执行时间。有没有办法加快加载我的网页 这是我的代码 <tbody> <?php $sql = $mysqli->query("SELECT * FROM mobile order by timestamp asc"); if ($sql->num_rows > 0) { while ($row = $sql->fetch_assoc()) { $conta

我的网页在调整时超过了300秒的最大执行时间。有没有办法加快加载我的网页

这是我的代码

<tbody>
    <?php
    $sql = $mysqli->query("SELECT * FROM mobile order by timestamp asc");
    if ($sql->num_rows > 0) {
        while ($row = $sql->fetch_assoc()) {
            $contactID = $row['id'];
            $contactName = $row['name'];
            $contactEmail = $row['email'];
            $contactAddress = $row['address'];
            $contactOthers = $row['others'];
            $contactNumber = $row['number']; ?>
            <tr>
                <td><?php echo $contactName; ?></td>
                <td><?php echo $contactNumber; ?></td>
                <td><?php echo $contactEmail; ?></td>
                <td><?php echo $contactAddress; ?></td>
                <td><?php echo $contactOthers; ?></td>
                <td class="td-actions text-center">
                    <a href="#edit<?php echo $contactID; ?>" data-toggle="modal">
                        <button type="button" title="Edit Contact" class="btn text-warning" style="background-color: transparent; border: none;">
                            <i class="fas fa-edit"></i>
                        </button>
                    </a>
                    <a href="#assign<?php echo $contactID; ?>" data-toggle="modal">
                        <button type="button" title="Assign to Group" class="btn text-primary" style="background-color: transparent; border: none;">
                            <i class="fas fa-object-group"></i>
                        </button>
                    </a>
                    <a href="#delete<?php echo $contactID; ?>" data-toggle="modal">
                        <button type="button" title="Delete Contact" class="btn text-danger" style="background-color: transparent; border: none;">
                            <i class="fas fa-trash-alt"></i>
                        </button>
                    </a>
                </td>
                <?php include 'xtensions/Actions/contactActions.php'; ?>
            </tr>
            <?php
        }
    }
    ?>
    </tbody>


在我的MySQL数据库中,我正在获取的行有306行。

您请求的包含在其中,而循环因此被包含并执行306次

<?php include 'xtensions/Actions/contactActions.php'; ?>


试着找到一种方法将其移出循环。

问题是你一次加载所有内容,试着将结果分成几页与Kevin一起。使用。这样做的作用是什么?300秒加载306行意味着这里有严重错误。不太可能是数据库访问造成的。在这种情况下,分页不太可能是答案@Kevin@RiggsFolly或者这一行可能进行http调用或API