本文章為你提供一款php簡單的偽原創程序,如果你正在找偽原創程序,這是一款簡單的php做的代碼.
db2word.php,代碼如下:
- <?php
- //將數據庫以數組形式寫到文件中
- require("conn.php");
- $res=mysql教程_query("select k1,k2 from ".table('keywords')." ") ;
- $str="<?php ";
- while($rs=mysql_fetch_array($res))
- {
- $str .="$keyword['".$rs[0]."']='".$rs[1]."'; ";
- }
- $str.="?>";
- file_put_contents("keyword.php",$str);
- echo "導出成功";
- ?>
代碼二,代碼如下:
- <?php
- //將文件中的數組寫入到數據庫中
- require("conn.php");
- @require("keyword.php");
- mysql_query("delete from ".table('keywords')."");
- foreach($keyword as $key=>$val)
- {
- //$key=iconv('utf-8','gbk',$key);
- //$val=iconv('utf-8','gbk',$val);
- $pinyin=getfirstchar($key);
- $ct=mysql_query("select count(*) from ".table('keywords')." where k1='$key' and k2='$val'");//檢測是否已經存在
- $ct=@mysql_fetch_array($ct);
- $ct=$ct[0];
- if($ct<=0)//不存在則插入
- { //開源代碼Vevb.com
- mysql_query("insert into ".table('keywords')."(k1,k2,pinyin) values('$key','$val','$pinyin')") or die("出錯");
- }
- }
- echo "插入成功!";
- ?>
新聞熱點
疑難解答