dedecms software adds description connection methods in batches_PHP tutorial

WBOY
Release: 2016-07-20 11:07:22
Original
932 people have browsed it

dedecms 软件批量增加描述连接方法
mysql教程_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 矢量 cc 矢量素材';
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;  
}
?>


www.bkjia.comtruehttp://www.bkjia.com/PHPjc/444969.htmlTechArticlededecms 软件批量增加描述连接方法 mysql教程_connect('localhost','root','root') or die('database connect failer'); mysql_select_db('m'); mysql_query(set Names 'gb2312')...
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template