时间:2021-07-01 10:21:17 帮助过:5人阅读
$a1 = '02';一般
$a2 = '01';
$a3 = '03';
$c1 = '01';
$c2 = '03';
$c3 = '05';
$na = 'a';
parse_str(str_replace(array(':', PHP_EOL), array('=', '&'), file_get_contents("data/$na.txt")), $ar);
foreach(preg_grep("/^$na\d+/", array_keys(get_defined_vars())) as $v) {
$$v = $ar[$$v];
}
$na = 'c';
parse_str(str_replace(array(':', PHP_EOL), array('=', '&'), file_get_contents("data/$na.txt")), $ar);
foreach(preg_grep("/^$na\d+/", array_keys(get_defined_vars())) as $v) {
$$v = $ar[$$v];
}
echo $a1, PHP_EOL;
echo $a2, PHP_EOL;
echo $a3, PHP_EOL;
echo $c1, PHP_EOL;
echo $c2, PHP_EOL;
echo $c3, PHP_EOL;