文章目录[隐藏]
$SA_IP=北京市;
$citya =北京市,天津市;
$cityb =上海市,深圳市;
$citys =$citya+$cityb;
if($SA_IP==$citys){// 表示找到匹 ?>
<?php require ‘../v/cpv.php’;?>
<?php }
else{
?>
<?php require ‘../ad/aa.php’;?>
<? }?>
就是当$SA_IP=北京市;,条件真。当$SA_IP=天津市;,条件真。 当$SA_IP=深圳市; ,条件真。
SQL有个like %% 可以模糊查询,就是我现在用PHP要怎么样去实现。
回复讨论(解决方案)
strpos
header ( 'Content-Type:text/html;charset=utf-8' );$SA_IP = '北京市';$citys = '北京市,天津市,上海市,深圳市';if (strpos ( $citys, $SA_IP ) !== false) { echo '存在';} else { echo '不存在';}
strpos楼上正解
header ( 'Content-Type:text/html;<em>¥本文来%源[email protected]搞@^&代*@码)网5</em><strong>搞gaodaima代码</strong>charset=utf-8' );$SA_IP = '北京市';$citys = '北京市,天津市,上海市,深圳市';if (strpos ( $citys, $SA_IP ) !== false) { echo '存在';} else { echo '不存在';}
$citya =北京市,天津市;
$cityb =上海市,深圳市;
$citys =$citya+$cityb;
$citys的数据是这$citya $cityb 相加的数据,能相加吗
header ( 'Content-Type:text/html;charset=utf-8' );$SA_IP = '北京市';$citys = '北京市,天津市,上海市,深圳市';if (strpos ( $citys, $SA_IP ) !== false) { echo '存在';} else { echo '不存在';}
谢谢 使用 $citys =$citya.$cityb; 就相加了