Home >Backend Development >PHP Tutorial >求一段php代码
$list = explode ("\n", str_replace ("\r", "", $name));foreach($list as $key=>$value){ $arr=explode('=',$value); $name_types[$arr[0]]=$arr[1]; }假设得出的数字是$key和$value1张三 2李四 3王斌 4李梅 5关静
if($_GET['action']==$key){
.....
}
$key = $_GET['action'];if(isset($name_types[$key])) {.....}
$list = explode ("\n", str_replace ("\r", "", $name));foreach($list as $key=>$value){ $arr=explode('=',$value); $name_types[$arr[0]]=$arr[1]; }$action = isset($_GET['action'])? $_GET['action'] : '';if(isset($name_types[$action])){ echo $name_types[$action];}