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 by this method are close to functiongetkey ($ contents) {$ rowsstrip_tags ($ contents); $ arrarray (, s, and php automatically extract the keyword in the article content. function method of seo-optimized website
The basic conditions of discuz are used to automatically extract keywords from the content of the article, so as to optimize the function method of website link.
Method 1: The keywords extracted by this method 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