【问题标题】: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://.*"/>