重定向 header 函数以用 PHP 替换已经存在的轮询 "thank you" 页面
Redirect header function to replace a poll "thank you" page already in place with PHP
我已经有一个 PHP 投票,但我已将其设置为有多个 (10),在每次提交投票后而不是说 "Thank You, blah blah"... 我是想直接进入下一个投票问题。
这就是我的。
投票已经有一个功能,在 "Thank You" 页面上有一个 "Continue to Next Poll" 按钮,我想删除这个按钮和页面,让它自动直接进入投票。我能想到的最好的方法就是转发 header.
转发到下一个投票的按钮示例:
<a href="<?php the_return_to_url(); ?>">Next</a>
因此,如果有人可以帮助我将其转换为与此一起使用:
<?php
header('Location: http://');
?>
"the_return_to_url()" 确定它进行的是什么民意调查并上升 1。
这是函数:
function the_return_to_url() {
global $requested_poll_id;
global $VALID_POLLS;
$poll = $VALID_POLLS[$requested_poll_id];
if(!empty($poll->returnToURL)) {
echo $poll->returnToURL;
} else {
vote_die("ERROR: Return to URL not defined for this poll.");
}
}
不修改原函数:
<?php
ob_start();
the_return_to_url();
header('Location: http://'.ob_get_clean());
die();
?>
我已经有一个 PHP 投票,但我已将其设置为有多个 (10),在每次提交投票后而不是说 "Thank You, blah blah"... 我是想直接进入下一个投票问题。
这就是我的。
投票已经有一个功能,在 "Thank You" 页面上有一个 "Continue to Next Poll" 按钮,我想删除这个按钮和页面,让它自动直接进入投票。我能想到的最好的方法就是转发 header.
转发到下一个投票的按钮示例:
<a href="<?php the_return_to_url(); ?>">Next</a>
因此,如果有人可以帮助我将其转换为与此一起使用:
<?php
header('Location: http://');
?>
"the_return_to_url()" 确定它进行的是什么民意调查并上升 1。
这是函数:
function the_return_to_url() {
global $requested_poll_id;
global $VALID_POLLS;
$poll = $VALID_POLLS[$requested_poll_id];
if(!empty($poll->returnToURL)) {
echo $poll->returnToURL;
} else {
vote_die("ERROR: Return to URL not defined for this poll.");
}
}
不修改原函数:
<?php
ob_start();
the_return_to_url();
header('Location: http://'.ob_get_clean());
die();
?>