$test = $_GET['nr'];
$class = new class;
echo $class->function($test);
我希望
$test
在页面完全加载后增加。
问题是,我不知道怎么办。循环 $test 通常会显示很多错误。就像
function cannot be declared again
我有相同的函数名称但具有不同的功能。而且代码很长。
有人知道我该怎么做吗? 谢谢。
编辑:
当页面完全加载时,我希望它向
$test
添加 + 1,然后使用新变量刷新它。
我可以通过以下方式手动执行此操作:
$next = $test + 1;
echo "<a href='/index.php?nr=". $next . "'>Next page</a>";
如果您将页面存储在字符串变量中并在最后输出,您只需进行元刷新即可:
$next = $test + 1;
echo "<meta http-equiv=\"refresh\" content=\"5; url=/index.php?nr=$next\">";
...加载完成后5秒刷新页面。
如果失败,您可以执行简单的 JavaScript 刷新:
$next = $test + 1;
echo "<script type=\"text/javascript\">\nfunction reloadPage() {\nwindow.location.href = '/index.php?nr=$next';\n}\nsetTimeout(reloadPage,5000);\n</script>";