php判断字符串是否包含指定字符串
作者:互联网
preg_match
$url = "https://www.baidu.com/api/users";
if (preg_match('/api/', $url)) {
return "包含";
} else {
return "不包含";
}
strpos
$url = "https://www.baidu.com/";
if (strpos($url, 'baidu') !== false) {
return "包含";
} else {
return "不包含";
}
标签:baidu,www,return,包含,url,preg,指定,字符串,php 来源: https://www.cnblogs.com/lujiahao/p/15485349.html