gpt4 book ai didi

javascript - 使用 php 自动刷新 div

转载 作者:行者123 更新时间:2023-11-28 00:12:02 25 4
gpt4 key购买 nike

我在使用 mvc 模式的自动刷新 div 标签时遇到问题。请帮助我...这是我的代码...包含 one1.php 的文件名:

 <?php 
$textnameObj = new textname();
$textname = $textnameObj->getCont('status','1');
echo $textname['details'];
?>

调用index.php中包含的文件名:

<html>
<head>
<script type="text/javascript">
setInterval("$('#autoref').load('includes/one1.php');", 10000);
</script>
</head>
<body>
<div id="autoref">
<?php include('includes/one1.php'); ?>
</div>
</body></html>

第二次刷新时出现此错误... fatal error :在第 2 行的 include/one1.php 中找不到类“textname”

最佳答案

index.php中,您已包含textname类文件。但如果您独立调用 includes/one1.php,则 textname 类未定义。

includes/one1.php 中,您必须 include_once一个文件,其中定义了 textname 类。

关于javascript - 使用 php 自动刷新 div,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30796949/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com