$res =mysql Tutorial _query ("Select K1,k2 from". Table (' keywords '). " ") ;
$STR = "<?php rn";
while ($rs =mysql_fetch_array ($res))
{
$str. = "$keyword ['". $rs [0]. "'] = ' ". $rs [1]." '; RN ";
}
$str. = "?>";
File_put_contents ("keyword.php", $str);
echo "Export Success";
Method Two
$f =file_get_contents ("W1.txt");
$f =str_replace ("RN", "<br>", $f);//Replace line feed
$arr =explode ("<br>", $f);
$STR = "<?php rn";
foreach ($arr as $t)
{
$rs =explode ("|", $t);
Cannot contain? and other special symbols
$str. = "$keyword ['] Str_replace ("? "," ", $rs [0]). = ' ". Str_replace ("? "," ", $rs [1])." '; RN ";
}
$str. = "?>";
File_put_contents ("keyword.php", $str);
echo "Export Success";
//conn.php file
$conn =mysql_connect ($mysql _host, $mysql _user, $mysql _password) or Die (' Connect server error ');
Mysql_ select_db ($mysql _db) or Die ("Select Database Error");
mysql_query ("Set names ' GBK '");
Function table ($t)
{
global $mysql _table_prefix
return $mysql _table_prefix. $t;
}
?