Add http:// prefix to URL when missing

前端 未结 10 1194
谎友^
谎友^ 2020-11-30 06:41

Hello I have a very simple code


    
Website
10条回答
  •  离开以前
    2020-11-30 07:05

    I believe David's answer is the proper way to do this, but it can be simplified like this:

    parse_url($aProfileInfo['Website'], PHP_URL_SCHEME)==''?'http://'.$aProfileInfo['Website']:$aProfileInfo['Website']
    

提交回复
热议问题