在foreach ($_POST as $key => $value)
我有这样的变量 title_1、title_2、title_3 之后。我需要使 $title 等于 $title_ + $id
我试过的
$link = ${$title_ . $id};
$title= $title_[$id];
$title= $title_[$id];
编码
foreach ($_POST as $key => $value)
{
if (preg_match('/^id_(\d*)$/', $value, $matches))
{
$id = $matches[1];
if (isset($_POST['title_' . $id]))
{
//$link = ${$title_ . $id};
$title= $title_[$id];
//mysql_query("UPDATE table SET title='" . $title . "' where id='$id'");
}
}
}
}