刷新页面被点击
问题描述:
我在当前页面http://localhost/checkout/purchase-confirmation/?payment_key=97de4a39e2a8c732e686d7414ff5951a刷新页面被点击
<form method="POST" action=''>
<input type="submit" name="deliver_confirmation" value=" Tôi đã nhận được đồ. Tôi đồng ý trả tiền cho Người Mua Hộ">
</form>
当它被点击有一个按钮,它像发送电子邮件,更新数据库。 然后最后,页面刷新。
if (isset($_POST['deliver_confirmation']))
{
//Update payment meta of deliver_status
$meta['deliver_status']= 'Đã giao hàng';
edd_update_payment_meta($payment->ID, '_edd_payment_meta', $meta);?>
//Refresh page
<meta http-equiv='refresh' content='0;"<?php get_permalink($payment->ID); ?>"'>
}
?>
的问题是,后页面刷新,它会被重定向到
http://localhost/checkout/purchase-confirmation/"
这是未找到页面错误。我不知道重定向网址的字符来自何处"
。
有没有更好的方法来刷新页面?也许添加一些JavaScript,或者等等等等......
答
试试这个
<?php
echo '<META http-equiv="refresh" content="0;URL='.get_permalink($payment->ID).'">';
?>
答
您可以实际使用header()
代替:
header (Location: get_permalink($payment->ID));
另外,如果你想使用meta refresh
,它应该是:
echo "<meta http-equiv='refresh' content='0; url=" . get_permalink($payment->ID) . "'>";
这不起作用。它被重定向到http:// localhost /?post_type = edd_payment&p = 7800 – John