有人可以帮助我执行此操作吗? “ call.php”页面在“ content_div” div上加载“ table__data.php”,但不会在3秒内自动刷新div。我正在创建一个页面,其中可以显示正在提供的队列票证。
这是我的table_data.php代码
<!-- <meta http-equiv="refresh" content="3" > -->
<table class="table table-bordered" cellpadding="0" cellspacing="0" border="0" class="display" width="100%">
<tr style="text-align: center;">
<th style="width: 30%; background-color: black;" align="center"><strong style="font-size: 50px; font-weight: bold; color: white; font-family:verdana; ">Ticket Number</strong></th>
<th style="width: 30%; background-color: black;" align="center"><strong style="font-size: 50px; font-weight: bold; color: white; font-family:verdana; ">Counter</strong></th>
</tr>
<?php
define('DB_SERVER', 'localhost');
define('DB_USERNAME', 'root');
define('DB_PASSWORD', '');
define('DB_NAME','dswd_qms');
$link=mysqli_connect(DB_SERVER,DB_USERNAME,DB_PASSWORD,DB_NAME);
if($link===false){
die("ERROR: Could not connect.". mysqli_connect_error());
}
$sql = "SELECT a.ticket_id, a.ticket_no, a.proceed_to
FROM qms_tickets AS a
WHERE a.ticket_date = CURDATE() AND a.ticket_status = 2 OR a.ticket_status = 4 AND enabled = 1";
$result = mysqli_query($link,$sql);
if($result->num_rows>0){
while($row=$result->fetch_assoc()){
echo "<tr style='text-align: center;'><td style='font-size: 97px; font-weight: bold; color: red; font-family:verdana;'>#".$row["ticket_no"]."</td><td style='font-size: 97px; font-weight: bold; color: red; font-family:verdana;'>".$row["proceed_to"]."</td></tr>";
}
echo "</table>";
}
else{
echo "0 Results";
}
?>
这是我的call.php代码
<div id="counter_div" >
<!-- <?php include_once'table_data.php'; ?> -->
</div>
<script type="text/javascript" src="assets/js/jquery.js"></script>
<script type="text/javascript">
$(document).ready(function(){
setInterval(function(){
$('#counter_div').load('table_data.php');
},3000);
});
</script>
答案 0 :(得分:0)
您尝试的解决方案不正确。试试这个,
string = 'hello world'
new_string = string.replace('l','r', 2)
output==> herro world