Today we will talk about a super simple and practical example, which is to tell you how to use the preg_match function to match whether the string has the content we want. Let's take matching date as an example.
代码如下 | 复制代码 |
if(preg_match("/d{4}-d{2}-d{2}/","开始大幅拉萨大家2012-02-02 12:12:12舍得离开房间")){ echo 'ye'; }else{ echo 'no'; } ?> |