$lang_result = array();
function f_language($lang)
{
if (is_array($lang) === true)
{
foreach ($lang as $key => $value)
{
$temp[] = "'$value'";
}
$lang = implode(',',$temp);
}
$qryLang = mssql_query ("
SELECT LANG_CODE,LANG_TEXT
FROM TLANGUAGE
WHERE LANG_ID = 'EN' --coocie.lang_id
AND LANG_CODE in ($lang)
");
global $lang_result;
while ($row = mssql_fetch_array($qryLang))
{
array_push($lang_result,array("$row[LANG_CODE]" => "$row[LANG_TEXT]"));
}
}
$lang_code = array();
array_push($lang_code,'ofc','sch');
#array_push($lang_code,'sch');
f_language($lang_code);
echo "<hr/>";
var_dump($lang_result);
输出:
array(2) { [0]=> array(1) { ["ofc"]=> string(6) "office" }
[1]=> array(1) { ["sch"]=> string(6) "school" }
}
我试过了,(array_search('office',$lang_result));
然后我没有得到索引值。有人请帮助我吗?