//index.php 頁面
$incpeizhi="inc.peizhi.php";
$arr=array('mark_h','mark_w','mark_name','mark_url','mark_type');
extract($_POST);
echo $mark_name;
echo "<br>";
$configstr = "";
foreach($arr as $v)
{
echo $v;
${$v} = str_replace("'","",${$v});
$configstr .= "\${$v} = '".${$v}."';\r\n";
}
$configstr = "<"."?php\r\n".$configstr."?".">\r\n";
$fp=fopen($incpeizhi,"w");
fwrite($fp,$configstr);
fclose($fp);
//=======================
//inc.peizhi.php 頁面
<?php
$mark_h = '200';
$mark_w = '150';
$mark_name = 'xinxi';
$mark_url = 'www.2cto.com';
$mark_type = '1';
?>
//===================
//form頁面
<form action="index.php" method="POST">
H:<input type="text" name="mark_h"><br>
W:<input type="text" name="mark_w"><br>
type:<input type="text" name="mark_type"><br>
url:<input type="text" name="mark_url"><br>
name:<input type="text" name="mark_name"><br>
<input type="submit" value="submit">
</form>
摘自 chaojie2009的專欄