【问题标题】:allow entry of url which only starts with https:// but not with any other protocols in laravel允许输入仅以 https:// 开头但不能以 laravel 中的任何其他协议开头的 url
【发布时间】:2018-08-07 05:16:53
【问题描述】:

我想在数据库中仅使用https:// 输入 url,但不使用任何其他协议。在 laravel-forms 中添加表单数据时。我尝试使用 ^(https:\/\/)(www\.){0,1}[a-zA-Z0-9\.\-]+\.[a-zA-Z]{2,5}[\w#!:.?+=&%@!\-\/]*[^\/]$,但它仍然使用 http:// 存储 url . 请建议我如何实现它。

【问题讨论】:

    标签: javascript php laravel-5.6


    【解决方案1】:

    您也可以使用 html 将 pattern 设置为如下所示的输入字段

    <input type="url" name="url" placeholder="https://example.com" pattern="https://.*"/>
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2012-12-19
      • 2020-02-12
      • 1970-01-01
      • 1970-01-01
      • 2017-11-19
      • 2017-04-01
      • 1970-01-01
      • 2016-03-23
      相关资源
      最近更新 更多