in_array变量赋值被当成一个值,求解决方法
in_array变量赋值被当成一个值,求解决方法
具体请看以下代码:
<?php
//$meb['learned']数据库取值为:排舞,街舞,主持人,讲师
$learn = explode(',',$meb['learned']);
//echo $learn[0].$learn[1].$learn[2].$learn[3].$learn[4].$learn[5];
$strp = str_replace(',', '", "', $meb['learned']);
$strp2 = '"'.$strp.'"';
$people = array($strp2);
print_r($people);
//以上输出结果为 Array ( [0] => "排舞", "街舞", "主持人", "讲师" )
if (in_array('讲师',$people)){
echo "Match found";
}
else
{
echo "Match not found";
}
?>