([\s\S]*?
.*?
)?#', '', $content);
// 去除链接
$content = preg_replace('#(.*)?#', '$2', $content);
return $content;
}
protected function getCover($listNode)
{
$cover = strpos($listNode->parents('li')->filter('img')->attr('src'), 'http') === false ? $this->config['domain'].$listNode->parents('li')->filter('img')->attr('src') : $listNode->parents('li')->filter('img')->attr('src');
$coverCon = file_get_contents($cover);
$coverRootPath = \Yii::getAlias('@staticroot').'/';
$coverFilePath = 'upload/image/'.date('Ymd').'/';
$coverFileName = time().mt_rand(100000, 999999).'.jpg';
if (!is_dir($coverRootPath.$coverFilePath)) {
mkdir($coverRootPath.$coverFilePath, 0777, true);
}
file_put_contents($coverRootPath.$coverFilePath.$coverFileName, $coverCon);
@chmod($coverRootPath.$coverFilePath, 0777);
return $coverFilePath.$coverFileName;
}
}