您好,欢迎来到三六零分类信息网!老站,搜索引擎当天收录,欢迎发信息

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

2024/4/7 12:39:27发布19次查看
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';
}
该用户其它信息

VIP推荐

免费发布信息,免费发布B2B信息网站平台 - 三六零分类信息网 沪ICP备09012988号-2
企业名录 Product