Home  >  Article  >  php教程  >  php简单的伪原创程序

php简单的伪原创程序

WBOY
WBOYOriginal
2016-05-25 16:42:372062browse

本文章为你提供一款php简单的伪原创程序,如果你正在找伪原创程序,这是一款简单的php做的代码.

db2word.php,代码如下:

<?php
//将数据库以数组形式写到文件中
require ("conn.php");
$res = mysql教程_query("select k1,k2 from " . table(&#39;keywords&#39;) . " ");
$str = "<?php ";
while ($rs = mysql_fetch_array($res)) {
    $str.= "$keyword[&#39;" . $rs[0] . "&#39;]=&#39;" . $rs[1] . "&#39;; ";
}
$str.= "";
file_put_contents("keyword.php", $str);
echo "导出成功";
?>

代码二,代码如下:

<?php
//将文件中的数组写入到数据库中
require ("conn.php");
@require ("keyword.php");
mysql_query("delete from " . table(&#39;keywords&#39;) . "");
foreach ($keyword as $key => $val) {
    //$key=iconv(&#39;utf-8&#39;,&#39;gbk&#39;,$key);
    //$val=iconv(&#39;utf-8&#39;,&#39;gbk&#39;,$val);
    $pinyin = getfirstchar($key);
    $ct = mysql_query("select count(*) from " . table(&#39;keywords&#39;) . " where k1=&#39;$key&#39; and k2=&#39;$val&#39;"); //检测是否已经存在
    $ct = @mysql_fetch_array($ct);
    $ct = $ct[0];
    if ($ct <= 0) //不存在则插入
    {
        mysql_query("insert into " . table(&#39;keywords&#39;) . "(k1,k2,pinyin) values(&#39;$key&#39;,&#39;$val&#39;,&#39;$pinyin&#39;)") or die("出错");
    }
}
echo "插入成功!";
?>


永久链接:

转载随意!带上文章地址吧。

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn