<small id='qrOmS'></small><noframes id='qrOmS'>

<legend id='qrOmS'><style id='qrOmS'><dir id='qrOmS'><q id='qrOmS'></q></dir></style></legend>

    <i id='qrOmS'><tr id='qrOmS'><dt id='qrOmS'><q id='qrOmS'><span id='qrOmS'><b id='qrOmS'><form id='qrOmS'><ins id='qrOmS'></ins><ul id='qrOmS'></ul><sub id='qrOmS'></sub></form><legend id='qrOmS'></legend><bdo id='qrOmS'><pre id='qrOmS'><center id='qrOmS'></center></pre></bdo></b><th id='qrOmS'></th></span></q></dt></tr></i><div id='qrOmS'><tfoot id='qrOmS'></tfoot><dl id='qrOmS'><fieldset id='qrOmS'></fieldset></dl></div>

      • <bdo id='qrOmS'></bdo><ul id='qrOmS'></ul>

    1. <tfoot id='qrOmS'></tfoot>
    2. PHP用POST数据打开另一个网页

      时间:2023-11-30

        <bdo id='O7mpS'></bdo><ul id='O7mpS'></ul>

        <i id='O7mpS'><tr id='O7mpS'><dt id='O7mpS'><q id='O7mpS'><span id='O7mpS'><b id='O7mpS'><form id='O7mpS'><ins id='O7mpS'></ins><ul id='O7mpS'></ul><sub id='O7mpS'></sub></form><legend id='O7mpS'></legend><bdo id='O7mpS'><pre id='O7mpS'><center id='O7mpS'></center></pre></bdo></b><th id='O7mpS'></th></span></q></dt></tr></i><div id='O7mpS'><tfoot id='O7mpS'></tfoot><dl id='O7mpS'><fieldset id='O7mpS'></fieldset></dl></div>

          <tbody id='O7mpS'></tbody>

              <small id='O7mpS'></small><noframes id='O7mpS'>

                <legend id='O7mpS'><style id='O7mpS'><dir id='O7mpS'><q id='O7mpS'></q></dir></style></legend>
                <tfoot id='O7mpS'></tfoot>
              1. 本文介绍了PHP用POST数据打开另一个网页的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                问题描述

                我是 PHP 新手,我正在尝试做一些可能是不好的做法并且很可能是不可能的事情.我基本上只是在拼凑一些东西来测试我的知识,看看 PHP 能做什么.

                I'm new to PHP and I'm trying to do something that may be bad practise and may well be impossible. I'm basically just hacking something together to test my knowledge and see what PHP can do.

                我有一个网页,其中包含收集数据的表单.这被提交给一个 PHP 脚本,该脚本执行一堆处理 - 但实际上并不显示任何重要的东西.我想要的是,一旦处理完成,脚本就会告诉浏览器打开另一个页面,显示结果.

                I have one webpage with a form that collects data. That is submited to a PHP script that does a bunch of processing - but doesn't actually display anything important. What I want is that once the processing is done, the script then tells the browser to open another page, where the results are displayed.

                我知道我可以使用 header('Location: page.php'); 但我不知道如何提供 POST 数据.我怎样才能做到这一点?或者,还有其他方法可以告诉浏览器打开另一个页面吗?

                I know I can use header('Location: page.php'); but I can't work out how to provide POST data with this. How can I do that? Alternatively, is there another way to tell the browser to open another page?

                我从回复中得到的是,可能使用各种黑客来做到这一点,但我最好将处理和显示代码放在一个文件中.我对此很满意;这比什么都重要.

                What I'm taking from the responses is that it's possible to do this using various hacks but I'd be better off to just have the processing and the display code in one file. I'm happy with that; this was an experiment more than anything.

                推荐答案

                真的需要处理完再调用另一个页面吗?我可能会做以下事情:

                Is it really necessary to call another page after the processing is done? I'd probably do the following:

                <form method="post" action="display.php">
                ...
                </form>
                

                display.php:

                display.php:

                if ($_POST) {
                    require_once(process.php);
                    process($_POST);
                    display_results;
                }
                

                包含处理 post 请求所需的代码的 process.php.

                with process.php containing the code necessary for processing the post request.

                或者,您可以使用 cURL 库之类的东西将处理结果传递给您自己指定的页面.不知道这是否真的是你所追求的.

                Alternatively, you could use something like the cURL library to pass the results of the processing to a page specified by yourself. Don't know if that's really what you're after though.

                这篇关于PHP用POST数据打开另一个网页的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                上一篇:导出到 csv wordpress 下一篇:如何对包含的文件(例如 .css)使用相对路径

                相关文章

                    <small id='RAui0'></small><noframes id='RAui0'>

                    <i id='RAui0'><tr id='RAui0'><dt id='RAui0'><q id='RAui0'><span id='RAui0'><b id='RAui0'><form id='RAui0'><ins id='RAui0'></ins><ul id='RAui0'></ul><sub id='RAui0'></sub></form><legend id='RAui0'></legend><bdo id='RAui0'><pre id='RAui0'><center id='RAui0'></center></pre></bdo></b><th id='RAui0'></th></span></q></dt></tr></i><div id='RAui0'><tfoot id='RAui0'></tfoot><dl id='RAui0'><fieldset id='RAui0'></fieldset></dl></div>
                      <bdo id='RAui0'></bdo><ul id='RAui0'></ul>
                    <tfoot id='RAui0'></tfoot>

                  1. <legend id='RAui0'><style id='RAui0'><dir id='RAui0'><q id='RAui0'></q></dir></style></legend>