简体   繁体   English

如何加快我的 Web 页面的加载速度?

[英]How can i speed up load up of my Web Page?

My web page exceed maximum execution time of 300 seconds as I adjust it.我的 web 页面在我调整时超过了 300 秒的最大执行时间。 Is there a way to speed up loading of my web page?有没有办法加快我的 web 页面的加载速度?

This is my code这是我的代码

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

In my MySQL Database that i am fetching rows has a 306 rows.在我正在获取行的 MySQL 数据库中,有 306 行。

Your requested include is inside while loop thus is included and executed 306 times您请求的包含在 while 循环内,因此被包含并执行了 306 次

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

try to find a way to move it outside the loop.尝试找到一种方法将其移出循环。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM