PHP if string contains URL isolate it

后端 未结 4 1238
借酒劲吻你
借酒劲吻你 2020-12-21 22:43

In PHP, I need to be able to figure out if a string contains a URL. If there is a URL, I need to isolate it as another separate string.

For example: \"SESAC showin t

4条回答
  •  北海茫月
    2020-12-21 23:35

    $test = "SESAC showin the Love! http://twitpic.com/1uk7fi";
    $myURL= strstr ($test, "http");
    echo $myURL; // prints http://twitpic.com/1uk7fi
    

提交回复
热议问题