In php, the keyword is automatically extracted from the document content. seo optimizes the website functions. Using the basic conditions of discuz, the keyword is automatically extracted from the article content. in this way, the function method 1 of the link in the website is optimized: the keywords extracted in this method are closer to functiongetkey ($ contents) {// $ rows = stri php, which automatically extracts the keyword of the article content. the Function Method of seo to optimize the website
Use the basic conditions of discuz to automatically extract keywords from the document content, and then optimize the function method of the website chain. Method 1: The extracted keywords are relatively close
function getkey($contents){ //$rows = strip_tags($contents);$arr = array(' ',' ',"\s", "\r\n", "\n", "\r", "\t", ">", "“", "”","
");$qc_rows = str_replace($arr, '', $rows);if(strlen($qc_rows)>2400){$qc_rows = substr($qc_rows, '0', '2400');}$data = @implode('', file("http://keyword.discuz.com/related_kw.html?title=$qc_rows&ics=gbk&ocs=gbk"));preg_match_all("/
(.*)A\[(.*)\]\](.*)><\/kw>/",$data, $out, PREG_SET_ORDER);$key="";for($i=0;$i<5;$i++){$key=$key.$out[$i][2];if($out[$i][2])$key=$key.",";}return $key; }
?
Method 2: The extracted keywords are slightly different from those above.
function getkey($contents){ $key = '';$rows = strip_tags($contents); $arr = array(' ',' ',"\s", "\r\n", "\n", "\r", "\t", ">", "“", "”"); $qc_rows = str_replace($arr, '', $rows); if(strlen($qc_rows)>2400){ $qc_rows = substr($qc_rows, '0', '2400'); } $data = @implode('', file("http://keyword.discuz.com/related_kw.html?title=$contents&ics=gbk&ocs=gbk")); preg_match_all("/
(.*)A\[(.*)\]\](.*)><\/kw>/",$data, $out, PREG_SET_ORDER); for($i=0;$i<5;$i++){ $key=$key.$out[$i][2]; if($out[$i][2])$key=$key.","; } return $key; }
? Haikou? Http://www.souhaikou.com