我试图创建一个简单的脚本来使用jQuery和PHP(我的代码如下)通过mysql创建通知。目前jquery每秒获取loadmore.php并更新包含它的div。我只是想知道,如果这个网站会流量很大,这是否会给服务器带来太大的压力?
源代码:
index.php -
Untitled Documentvar auto_refresh = setInterval(
function ()
{
$('#notifications').load('loadmore.php');
}, 1000); // refresh every 10000 milliseconds
loadmore.php -
include('config.php');
?>
$sql=mysql_query("select * from updates ORDER BY item_id DESC LIMIT 9");
while($row=mysql_fetch_array($sql))
{
$msg_id=$row['item_id'];
$message=$row['item_content'];
?>