Donnie Thomas
Donnie Thomas

Reputation: 4038

Yii Framework: Specifying defaultScheme in URL Validator

I'm sure this is straightforward, but I can't figure it out. I'm trying to set a defaultScheme to the Yii URL validator in my model, so that it accepts addresses like www.something.com as well as http://www.something.com.

To do this, I'm using the following code:

...
array('website', 'url', 'defaultScheme' => 'http://'),
...

This doesn't seem to be working, and I still get an "Website is not a valid URL" error when trying to update. What am I doing wrong?

Upvotes: 5

Views: 3951

Answers (2)

蔡正海
蔡正海

Reputation: 483

array('website', 'url', 'defaultScheme' => 'http')

Upvotes: 0

Neil McGuigan
Neil McGuigan

Reputation: 48267

just http

http is the scheme name, whereas http:// is the scheme plus the beginning of the "hierarchical part"

Upvotes: 6

Related Questions