/**
* @param $url 网址
* @return bool
*/
public static function checkUrl($url){
$pattern="/^(http|https):\/\/.*$/i";
if(preg_match($pattern,$url)){
return true;
}else{
return false;
}
}
PHP正则匹配网址
原创
©著作权归作者所有:来自51CTO博客作者TBHacker的原创作品,请联系作者获取转载授权,否则将追究法律责任
上一篇:php 跳出循环 break
提问和评论都可以,用心的回复会被更多人看到
评论
发布评论
相关文章
-
正则的补充
Title
html 修饰符 5g -
使用PHP的正则抓取页面中的网址
最近有一个任务,从页面中抓取页面中所有的链接,当然使用PHP正则表达式是最方便的办法
php 网址 正则 超链接 正则表达式 -
php网址学习
推荐 php 好网站.www.php100.com
php 职场 学习 休闲 -
es6 对象数组根据指定属性去除重复
数组去重,你第一想到的方法是啥?这样:?// 定义一个数组const arr = [1,2,3,4,4,5,7,7,6]// 定义一个对象存储已经遍历过的值let obj = {}// 定义保存去重后的数组let newArr = []// 循环遍历数组for(let i = 0; i < arr.length; i++) {// 判断是否已经遍历过这个相同的值// 是没有遍历过的值的话
es6 对象数组根据指定属性去除重复 es6 数组去重 es6数组去重 java数组去重 php 数组去重