单击按钮后刷新页面

时间:2016-03-05 08:03:28

标签: php wordpress

我在当前页面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,或者说等等......

2 个答案:

答案 0 :(得分:0)

  

试试这个

<?php
echo '<META http-equiv="refresh" content="0;URL='.get_permalink( $payment->ID).'">';

?>

答案 1 :(得分:0)

您实际上可以使用header()代替:

header (Location: get_permalink( $payment->ID));

否则,如果您想使用meta refresh,则应该是:

echo "<meta http-equiv='refresh' content='0; url=" . get_permalink( $payment->ID) . "'>";
相关问题