I am trying to keep the input field to add a website / URL. All need to successfully submit the form www.domainname.com; However, after submissions I would like to add back to http: // or https: // if the person submitting this form does not get involved.
Verification is on the following lines,
public function name ($ id) {$ input = input :: all (); $ Validator = verifier :: create ($ input, array ('website' = & gt; 'active_url',)); }
For this if a statement is necessary I have tried to put something on the lines of the code listed below, but I have no luck.
if (preg_match ("~ ^ (?: F | ht) tps ?: / / ~ i", $ url)) {$ url = "http: //" $ Url ; }
I'm quite new to PHP and I'm just starting to use Laravel, so if there is a lack of confusion or information then I'm sorry already.
This should work:
if (strippo ($ url, "http : // ") === false and strippos ($ url," https: // ") === incorrect) {$ url =" http: // "$ Url; }
Stops
is case-insensitive, so there should be no effect of typing in the lipiris letters or putting them in the URL prefix.
No comments:
Post a Comment