Home > Backend Development > PHP Tutorial > PHP不点击按钮post并跳转

PHP不点击按钮post并跳转

WBOY
Release: 2016-06-06 20:40:20
Original
881 people have browsed it

需求:

比如有个a.php,用户访问,自动post数据到b.php并且跳转到b.php

效果就跟点击form里面的按钮一样,但是没有那个按钮,用户不用点击,自动完成

不知道有没有实现方法?

回复内容:

需求:

比如有个a.php,用户访问,自动post数据到b.php并且跳转到b.php

效果就跟点击form里面的按钮一样,但是没有那个按钮,用户不用点击,自动完成

不知道有没有实现方法?

程序自动完成表单提交的动作。

<code>        $sHtml = "<form id="submit" name="submit" action="%22.%24action.%22" method='".$method."'>";
    $sHtml.= "<input type="hidden" name='".$key."' value='".$val."'>";
    $sHtml = $sHtml."</form>";
    $sHtml = $sHtml."<script>document.forms['submit'].submit();</script>";

    return $sHtml;
</code>
Copy after login

在a.php中先用fsockopen提交post数据。
然后用输出一段JS,跳转到b.php

curl post 接着header跳转

Related labels:
php
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template