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

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

        <bdo id='r5nT1'></bdo><ul id='r5nT1'></ul>
    1. <tfoot id='r5nT1'></tfoot>

        使用 Zend 框架处理输入(Post、get 等)

        Handling input with the Zend Framework (Post,get,etc)(使用 Zend 框架处理输入(Post、get 等))
      1. <legend id='Z42UB'><style id='Z42UB'><dir id='Z42UB'><q id='Z42UB'></q></dir></style></legend>
        <tfoot id='Z42UB'></tfoot>

              <tbody id='Z42UB'></tbody>

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

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

                  <bdo id='Z42UB'></bdo><ul id='Z42UB'></ul>
                • 本文介绍了使用 Zend 框架处理输入(Post、get 等)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我在 zend 代码上重构了 php,所有代码都充满了 $_GET["this"]$_POST["that"].我一直使用更多的 phpish $this->_request->getPost('this')$this->_request->getQuery('that')(这个与 getquery 而不是 getGet 不太合逻辑).

                  im re-factoring php on zend code and all the code is full of $_GET["this"] and $_POST["that"]. I have always used the more phpish $this->_request->getPost('this') and $this->_request->getQuery('that') (this one being not so much logical with the getquery insteado of getGet).

                  所以我想知道我的方法是否更安全/更好/更容易维护.我在 Zend Framework 文档中读到您必须验证自己的输入,因为请求对象不会这样做.

                  So i was wondering if my method was safer/better/easier to mantain. I read in the Zend Framework documentation that you must validate your own input since the request object wont do it.

                  这给我留下了两个问题:

                  That leaves me with 2 questions:

                  • 这两个哪个最好?(或者如果有另一种更好的方法)
                  • 使用此方法验证 php 输入的最佳做法是什么?

                  谢谢!

                  推荐答案

                  我通常使用 $this->_request->getParams();检索帖子或 URL 参数.然后我使用 Zend_Filter_Input 进行验证和过滤.getParams() 不做验证.

                  I usually use $this->_request->getParams(); to retrieve either the post or the URL parameters. Then I use the Zend_Filter_Input to do validation and filtering. The getParams() does not do validation.

                  使用 Zend_Filter_Input,您可以使用 Zend 验证器(或者您也可以编写自己的)进行应用程序级验证.例如,您可以确保 'months' 字段是一个数字:

                  Using the Zend_Filter_Input you can do application level validation, using the Zend Validators (or you can write your own too). For example, you can make sure the 'months' field is a number:

                  $data = $this->_request->getParams();
                  
                  $validators = array(
                      'month'   => 'Digits',
                  );
                  
                  $input = new Zend_Filter_Input($filters, $validators, $data);
                  

                  这篇关于使用 Zend 框架处理输入(Post、get 等)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

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

                  相关文档推荐

                  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 的问题)
                • <i id='u7cEO'><tr id='u7cEO'><dt id='u7cEO'><q id='u7cEO'><span id='u7cEO'><b id='u7cEO'><form id='u7cEO'><ins id='u7cEO'></ins><ul id='u7cEO'></ul><sub id='u7cEO'></sub></form><legend id='u7cEO'></legend><bdo id='u7cEO'><pre id='u7cEO'><center id='u7cEO'></center></pre></bdo></b><th id='u7cEO'></th></span></q></dt></tr></i><div id='u7cEO'><tfoot id='u7cEO'></tfoot><dl id='u7cEO'><fieldset id='u7cEO'></fieldset></dl></div>

                      <tbody id='u7cEO'></tbody>
                    1. <small id='u7cEO'></small><noframes id='u7cEO'>

                      <tfoot id='u7cEO'></tfoot>
                      <legend id='u7cEO'><style id='u7cEO'><dir id='u7cEO'><q id='u7cEO'></q></dir></style></legend>

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