<?php defined('IN_PHPCMS') or exit('No permission resources.'); $number = intval($_GET['number']); $title = $_POST['data']; echo get_keywords($title, $number); function get_keywords($title, $number = 3) { $title = trim(strip_tags($title)); if (empty($title)) { return ''; } $url = 'http://116.196.101.207/get.php?source=' . urlencode($title) . '¶m1=1¶m2=1&json=1'; $res = file_get_contents($url); $resArr = json_decode($res, true); $keywords = []; foreach ($resArr as $k => $v) { $keywords[] = $v['t']; } return implode(' ', $keywords); }
把代码替换掉文件api/get_keywords.php就可以了