我有一个php文件,它从数据库中生成一个值,我希望该值在网站的标题框中不断显示。
我试过了:
<script>
function autoRefresh_title()
{
$.post("currentbank.php").done(function(response){
document.title(response)
setInterval('autoRefresh_title()', 1000);
</script>
上面的代码在index.php文件中,currentbank.php是:
<?php
@include_once ("set.php");
$game = fetchinfo("value","info","name","current_game");
echo round(fetchinfo("cost","games","id",$game),2);
?>
PS:set.php只是登录信息
document.title(response);
更改为:
document.title = response;