DEDECMS Software Bulk Add Description connection method
MySQL tutorial _connect (' localhost ', ' root ', ' root ') or Die (' Database connect Failer ');
mysql_select_db (' m ');
mysql_query ("Set Names ' gb2312 '");
$sql = "Select Aid,introduce from D_addonsoft ORDER BY aid desc limit 0,2";
$query = mysql_query ($sql);
while ($rs = Mysql_fetch_array ($query))
{
$body = Keywords ($rs [' introduce '], $array);
$s = "Update d_addonsoft set introduce = ' $body ' where aid= '. $rs [' aid '];
mysql_query ($s);
Echo $body, '
';
}
$array = Array (
Array (' AA ', '/bb/'),
Array (' CC ', ' 111cnnet ')
);
$str = ' bb vector cc vector material ';
echo keywords ($str, $array);
function keywords ($str, $array)
{
$count = 0;
foreach ($array as $v) {
echo $v [0], '
';
if (Strstr ($str, $v [0])!==false) {
if ($count <=2) {
$str =preg_replace ("/$v [0]/", "". $v [0]. ", $STR, 1);
$count + +;
Continue
}
}
}
return $str;
}
?>
http://www.bkjia.com/PHPjc/444969.html www.bkjia.com true http://www.bkjia.com/PHPjc/444969.html techarticle dedecms Software Bulk Add description connection method MySQL tutorial _connect (' localhost ', ' root ', ' root ') or Die (' Database connect Failer '); mysql_select_ db (' m '); mysql_query (set Names ' gb2312 ') ...