I
I
Ilya Beloborodov2017-02-23 17:31:51
Yii
Ilya Beloborodov, 2017-02-23 17:31:51

Yii\validators\UrlValidator without http and https?

How to forbid to enter the name of the protocol? Tried like this

['url', \yii\validators\UrlValidator::className(), 'validSchemes' => []],

But in this case, the options http://example.comand example.comboth are not valid.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
Ilya Beloborodov, 2017-02-23
@kowap

Decided so

['url', \yii\validators\UrlValidator::className(), 'pattern' => '/^([a-z0-9\.-]{4,})$/i'],

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question