$a是一个数组
if (strlen($q) > 0)
{
$hint="";
for($i=0; $i<count($a); $i++)
{
//strtolower将所有字母转换为小写
//substr返回指定长度字符串
if (strtolower($q)==strtolower(substr($a[$i],0,strlen($q))))
{
if ($hint=="")
{
$hint=$a[$i];
}
else
{
$hint=$hint." , ".$a[$i];
}
}
}
}
网友评论