Esempio n. 1
0
 public function getwiki($searchwords, $flag)
 {
     //敏感词
     $wechat_globleObj = new wechat_globle();
     $namesArray = $wechat_globleObj->getwikiarray();
     $arrarycount = count($namesArray);
     for ($i = 0; $i < $arrarycount; $i++) {
         if (strstr($searchwords, $namesArray[$i])) {
             return '要不问点别的好不好...';
         }
     }
     $contentStr = $this->getwikiContent($searchwords, $flag);
     if (strlen($contentStr) == 0 || strstr($contentStr, '维基百科目前还没有与上述标题相同的条目。') !== false) {
         if (preg_match("/^[a-zA-Z0-9]+\$/", $searchwords)) {
             $searchwords = strtoupper($searchwords);
             $contentStr = $this->getwikiContent($searchwords, $flag);
             if (strlen($contentStr) == 0 || strstr($contentStr, '维基百科目前还没有与上述标题相同的条目。') !== false) {
                 $contentStr = "亲,这个我得想想^-^\n\n----------\n试试回复:\n名词 {$searchwords} \n";
             }
         } else {
             $contentStr = "亲,这个我得想想^-^\n\n----------\n试试回复:\n名词 {$searchwords} \n";
         }
     }
     $contentStr = str_replace('&quot;', '"', $contentStr);
     return $contentStr;
 }