PHPCMS文章页详情调用第三方分词接口

效果不怎么好,效率和速度较差,仅仅记录分享。

修改路径\phpcms\libs\functions\extention.func.php
//分词
function httppost($title){
	$ch = curl_init();
	$options = array(
    CURLOPT_URL => 'http://api.pullword.com/get.php?source='.$title.'&param1=0&param2=0',
    CURLOPT_HEADER => 0, //不看头部
    CURLOPT_RETURNTRANSFER => true, //返回响应内容
    CURLOPT_FOLLOWLOCATION => false, //支持重定向
    CURLOPT_SSL_VERIFYPEER => false, //设置不用服务器端证书验证
	);
	curl_setopt_array($ch, $options);
	$result = curl_exec($ch);
	curl_close($ch); 
	return $result;
	}
 
修改模版show.html调用
<strong>分词测试:</strong>{$httppost($title)}


posted @ 2020-11-28 20:49  MRtanchen  阅读(188)  评论(0编辑  收藏  举报