如何重写此部分以使其更加专业?也许有某种方法可以将中间 6 行合并为 1 行?
if($hyperlink){
$hyperlink_new=$hyperlink;
$hyperlink_new=str_replace("row[0]", $row[0], $hyperlink_new);
$hyperlink_new=str_replace("row[1]", $row[1], $hyperlink_new);
$hyperlink_new=str_replace("row[2]", $row[2], $hyperlink_new);
$hyperlink_new=str_replace("row[3]", $row[3], $hyperlink_new);
$hyperlink_new=str_replace("row[4]", $row[4], $hyperlink_new);
$hyperlink_new=str_replace("row[5]", $row[5], $hyperlink_new);
echo "<a href=\"$hyperlink_new\">";
}
谢谢。
最佳答案
if($hyperlink){
$hyperlink_new=$hyperlink;
for ($i=0; $i<6; $i+=1) {
$hyperlink_new=str_replace("row[$i]", $row[$i], $hyperlink_new);
}
echo "<a href=\"$hyperlink_new\">";
}
关于PHP - 我怎样才能重写这一部分以使其更专业?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6064532/