<code>// 匹配http(s)的表达式
$preg = "/^http(s)?:\\\\/\\\\/.+/";/<code>
示例:
<code>$url = "http://www.yebinbing.win/";
$preg = "/^http(s)?:\\\\/\\\\/.+/";
if(preg_match($preg,$url))
{
echo 'Yes';
}else
{
echo 'No';
}/<code>
运行结果:
<code>No/<code>
![正则表达式判断网址是否带http://或https://(php代码)](http://p2.ttnews.xyz/loading.gif)
閱讀更多 商務互吹 的文章