使用发布数据重定向URL [英] Redirect a URL with Post data
本文介绍了使用发布数据重定向URL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想使用一些POST数据将用户从page1重定向到page2.Page1和page2在两个不同的域上,并且我可以同时控制其中的 >
第1页
<?php
$chars="stackoverflowrules"
?>
我想将字符作为帖子数据提交,并重定向到第2页.
然后一页2我想使用POST数据
<?php
$token = $_POST['chars'];
echo $token;
?>
解决方案
我使用表单和JS做到了
在第1页
<?php
$chars="stackoverflowrules";
?>
<html>
<form name='redirect' action='page2.php' method='POST'>
<input type='hidden' name='chars' value='<?php echo $chars; ?>'>
<input type='submit' value='Proceed'>
</form>
<script type='text/javascript'>
document.redirect.submit();
</script>
</html>
第2页
<?php
$token = $_POST['chars'];
echo $token;
?>
I want to redirect a user from page1 to page2 with some POST data .Page1 and page2 are on two different domains and i have control over both of them
Page 1
<?php
$chars="stackoverflowrules"
?>
I want to submit the chars as a post data and the redirect to page 2.
Then one page 2 i want to use the POST data like
<?php
$token = $_POST['chars'];
echo $token;
?>
解决方案
I did it using a form and JS
On page 1
<?php
$chars="stackoverflowrules";
?>
<html>
<form name='redirect' action='page2.php' method='POST'>
<input type='hidden' name='chars' value='<?php echo $chars; ?>'>
<input type='submit' value='Proceed'>
</form>
<script type='text/javascript'>
document.redirect.submit();
</script>
</html>
On page 2
<?php
$token = $_POST['chars'];
echo $token;
?>
这篇关于使用发布数据重定向URL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文