• <bdo id='pYidZ'></bdo><ul id='pYidZ'></ul>
    1. <legend id='pYidZ'><style id='pYidZ'><dir id='pYidZ'><q id='pYidZ'></q></dir></style></legend>

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

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

        required_if laravel 具有多个值

        Required_if laravel with multiple value(required_if laravel 具有多个值)
        <i id='dDpOV'><tr id='dDpOV'><dt id='dDpOV'><q id='dDpOV'><span id='dDpOV'><b id='dDpOV'><form id='dDpOV'><ins id='dDpOV'></ins><ul id='dDpOV'></ul><sub id='dDpOV'></sub></form><legend id='dDpOV'></legend><bdo id='dDpOV'><pre id='dDpOV'><center id='dDpOV'></center></pre></bdo></b><th id='dDpOV'></th></span></q></dt></tr></i><div id='dDpOV'><tfoot id='dDpOV'></tfoot><dl id='dDpOV'><fieldset id='dDpOV'></fieldset></dl></div>

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

          • <bdo id='dDpOV'></bdo><ul id='dDpOV'></ul>
                  <tbody id='dDpOV'></tbody>

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

                1. <tfoot id='dDpOV'></tfoot>
                  本文介绍了required_if laravel 具有多个值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我有一个这样的下拉菜单:

                  I have a dropdown menu like this:

                  <select name="selection">
                     <option value="1">Option 1</option>
                     <option value="2">Option 2</option>
                     <option value="3">Option 3</option>
                  </select>
                  <input type="text" name="stext">
                  

                  我想要 laravel 中的以下内容:

                  I want the following in laravel:

                  public static myfunction(){
                     $input = Input::only('selection','stext');
                     $rule = array(
                        'selection' => 'required',
                        'stext' => 'required_if:selection,2,3',
                     );
                     $validate = Validator::make($input,$rule);
                  }
                  

                  但如果我选择选项 1,stext 仍然是必需的.为什么?我该如何解决?

                  But if I select option 1, stext is still required. Why? How can I fix it?

                  推荐答案

                  正如 LePhleg answer 所指出的,这个验证有一个最好的语法:

                  As pointed out by LePhleg answer, there is a nicest syntax for this validation:

                  $rule = array(
                    'selection' => 'required',
                    'stext' => 'required_if:selection,2,3,
                  );
                  

                  下面的旧答案:

                  我认为 require_if 验证每次只接受一个值.尝试更改您的验证码如下:

                  I think that the require_if validation accept only one value per time. Try to change your validation code as below:

                  $rule = array(
                    'selection' => 'required',
                    'stext' => 'required_if:selection,2|required_if:selection,3',
                  );
                  

                  检查LePhleg的答案,更干净.在不可能的答案时,只需检查问题,他使用相同的方法但没有工作.

                  Check LePhleg answer, is more cleaner. At the time of the answer that was not possible, just check the question, he was using the same method but not worked.

                  这篇关于required_if laravel 具有多个值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

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

                  相关文档推荐

                  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 的问题)

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

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

                        • <bdo id='i4Ig3'></bdo><ul id='i4Ig3'></ul>
                        • <legend id='i4Ig3'><style id='i4Ig3'><dir id='i4Ig3'><q id='i4Ig3'></q></dir></style></legend>
                        • <tfoot id='i4Ig3'></tfoot>
                              <tbody id='i4Ig3'></tbody>