echo "Over!\r\n"; break; } //关注专题/文集 collection($userArr); //构造数据 // $userArr = array('id' => 7231, 'name' => 'f93e84d2e162'); //关注用户 following($userArr); //粉丝 follower($userArr); //文章 articles($userArr); $id = $userArr['id']; file_put_contents('user.txt', $id); $db->clear(); } //关注专题/文集 function collection($userArr) { global $db, $curl; $page = 1; while (true) { $url = "http://www.jianshu.com/users/{$userArr['name']}/subscriptions?page={$page}"; $curl->setUrl($url); $html = $curl->run(); $p = '/<h4><a href="\\/collection\\/(.*?)"/'; preg_match_all($p, $html, $match); if (is_array($match[1]) && !empty($match[1])) { foreach ($match[1] as $value) { $temp = $db->get('collection', '*', array('name' => $value));