PHP头条
热点:

php怎么用正则表达式判断连接和时间是否合法


php如何用正则表达式判断连接和时间是否合法。
时间只显示年月日,时间格式为2008-08-08
连接地址的话,要考虑http,https这两种情况吧,或者你有更全的更好。 分享到:
------解决方案--------------------
$s='2008-08-08';
echo $s == date("Y-m-d",strtotime($s)) ? 'yes' : 'no' ;

网址的话网上搜,太多了。
------解决方案--------------------
$url = "http://www.liuxingyuyuni.cublog.cn";
if(!preg_match('^(http
------解决方案--------------------
https)\:\/\/([a-zA-Z0-9]+\.)?([a-zA-Z0-9]+\.[a-zA-Z0-9]+)+', $url))
{
echo 'wrong';
}
else 
{
echo 'ok';
}

www.phpzy.comtrue/phprm/12195.htmlTechArticlephp怎么用正则表达式判断连接和时间是否合法 php如何用正则表达式判断连接和时间是否合法。 时间只显示年月日,时间格式为2008-08-08 连接地址的话,要考虑http,https这两种情况吧,或...

相关文章

相关频道:

PHP之友评论

今天推荐