在php中我們可以使用header方法來實現頁面的跳轉,如:
$url = 'http://www.wj0511.com';
header("Location: " . $url);
exit();
使用header方法可以實現頁面跳轉,但是隻支持get跳轉,當我們需要實現post跳轉的話,使用header方法就無法實現了,這時候我們可以在php中執行js跳轉來實現post跳轉,如:
$url = 'http://www.wj0511.com';
echo <<<EOT
<form name='test' action='{$url}' method='POST'>
</form>
<script type='text/javascript'>
document.test.submit();
</script>
EOT;
exit;
如上我們就可以實現post跳轉功能了