调整后,我的网页超过了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行。
答案 0 :(得分:0)
您请求的包含在while循环内,因此被包含并执行306次
<?php include 'xtensions/Actions/contactActions.php'; ?>
尝试找到一种将其移出循环的方法。