<bdo id='9nCCs'></bdo><ul id='9nCCs'></ul>

    1. <small id='9nCCs'></small><noframes id='9nCCs'>

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

        $_POST 的替代品

        alternative to $_POST($_POST 的替代品)
          <bdo id='cmnbE'></bdo><ul id='cmnbE'></ul>

          <tfoot id='cmnbE'></tfoot>

              • <small id='cmnbE'></small><noframes id='cmnbE'>

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

                  本文介绍了$_POST 的替代品的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我有一个巨大的表单输入类型(文本、复选框、隐藏等).表单输入的内容取自数据库.用户必须进行一些更改并将数据保存回数据库.

                  I have a huge form with inputs of type (text, checkboxes, hidden et). The content of the form inputs are taken from a database. The user has to make some changes and to save the data back into the db.

                  此时我正在使用一个具有 foreach($_POST as $key=>$value) 循环的函数.如您所知,post 方法存在问题:

                  At this moment I'm using a function which has a foreach($_POST as $key=>$value) loop. As you know, there are problems with post method:

                  1. 无法刷新,
                  2. 不能倒退.

                  我想使用 $_GET 方法,但我的变量和值的长度大于 2000 个字符.

                  I'll like to use $_GET method, but the length of my variables and values are bigger than 2000 characters.

                  你对我有什么建议,我能做什么?也许使用 $_GET 有一些技巧.也许我不明白如何正确使用它?

                  Do you have any advice for me, about what can I do? Maybe there are some tricks in using $_GET. Maybe i didn't understand how to use it right?

                  推荐答案

                  POST 本身绝对没有问题.你只需要正确使用它
                  HTTP 标准规定您应该在收到 POST 请求后进行 GET 重定向.
                  所以,像这样简单的代码

                  There is absolutely nothing wrong in POST itself. You just have to use it properly
                  An HTTP standard says you ought to make a GET redirect after receiving POST request.
                  So, as easy code as this

                      header("Location: ".$_SERVER['PHP_SELF']);
                      exit;
                  

                  处理您的表单后将解决您所有的问题"

                  after processing your form will solve all your "problems"

                  如果你想处理 post 错误,你可以使用 POST/Redirect/GET 模式.但是它不会在错误时重定向,您提到的问题变得可以忽略不计.

                  in case you want to handle post errors, you can use POST/Redirect/GET pattern. However it does not redirect on error, the problems you mentioned becoming negligible.

                  这是一个简洁的例子:

                  <?  
                  if ($_SERVER['REQUEST_METHOD']=='POST') {  
                    //processing the form    
                    $err = array();
                    //performing all validations and raising corresponding errors
                    if (empty($_POST['name']) $err[] = "Username field is required";  
                    if (empty($_POST['text']) $err[] = "Comments field is required";  
                  
                    if (!$err) {  
                      //if no errors - saving data and redirect
                      header("Location: ".$_SERVER['PHP_SELF']);
                      exit;
                    }  else {
                      // all field values should be escaped according to HTML standard
                      foreach ($_POST as $key => $val) {
                        $form[$key] = htmlspecialchars($val);
                      }
                  } else {
                    $form['name'] = $form['comments'] = '';  
                  }
                  include 'form.tpl.php';
                  ?>  
                  

                  出错时,它会返回表单.但在成功提交表单后,它也会重定向.

                  on error it will show the form back. but after successful form submit it will redirect as well.

                  这篇关于$_POST 的替代品的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  DeepL的翻译效果还是很强大的,如果我们要用php实现DeepL翻译调用,该怎么办呢?以下是代码示例,希望能够帮到需要的朋友。 在这里需要注意,这个DeepL的账户和api申请比较难,不支持中国大陆申请,需要拥有香港或者海外信用卡才行,没账号的话,目前某宝可以
                  PHP通过phpspreadsheet导入Excel日期,导入系统后,全部变为了4开头的几位数字,这是为什么呢?原因很简单,将Excel的时间设置问文本,我们就能看到该日期本来的数值,上图对应的数值为: 要怎么解决呢?进行数据转换就行,这里可以封装方法,或者用第三方的
                  mediatemple - can#39;t send email using codeigniter(mediatemple - 无法使用 codeigniter 发送电子邮件)
                  Laravel Gmail Configuration Error(Laravel Gmail 配置错误)
                  Problem with using PHPMailer for SMTP(将 PHPMailer 用于 SMTP 的问题)
                  Issue on how to setup SMTP using PHPMailer in GoDaddy server(关于如何在 GoDaddy 服务器中使用 PHPMailer 设置 SMTP 的问题)
                    <tbody id='Y6D1m'></tbody>
                1. <i id='Y6D1m'><tr id='Y6D1m'><dt id='Y6D1m'><q id='Y6D1m'><span id='Y6D1m'><b id='Y6D1m'><form id='Y6D1m'><ins id='Y6D1m'></ins><ul id='Y6D1m'></ul><sub id='Y6D1m'></sub></form><legend id='Y6D1m'></legend><bdo id='Y6D1m'><pre id='Y6D1m'><center id='Y6D1m'></center></pre></bdo></b><th id='Y6D1m'></th></span></q></dt></tr></i><div id='Y6D1m'><tfoot id='Y6D1m'></tfoot><dl id='Y6D1m'><fieldset id='Y6D1m'></fieldset></dl></div>

                    <bdo id='Y6D1m'></bdo><ul id='Y6D1m'></ul>
                    <tfoot id='Y6D1m'></tfoot>

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

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