//自动提取摘要,如果有设置自动提取,且description为空,且有内容字段才执行
if (isset($_POST['add_introduce']) && $systeminfo['description'] == '' && isset($modelinfo['content'])) {
$content = stripslashes($modelinfo['content']);
$introcude_length = intval($_POST['introcude_length']);
$systeminfo['description'] = str_cut(str_replace(array("\r\n", "\t", '[page]', '[/page]', '“', '”', ' '), '', strip_tags($content)), $introcude_length);
$inputinfo['system']['description'] = $systeminfo['description'] = Input::getVar($systeminfo['description']);
}
//自动提取缩略图,从content 中提取
if (isset($_POST['auto_thumb']) && $systeminfo['thumb'] == '' && isset($modelinfo['content'])) {
$content = $content ? $content : stripslashes($modelinfo['content']);
$auto_thumb_no = intval($_POST['auto_thumb_no']) - 1;
if (preg_match_all("/(src)=([\"|']?)([^ \"'>]+\.(gif|jpg|jpeg|bmp|png))\\2/i", $content, $matches)) {
$systeminfo['thumb'] = $matches[3][$auto_thumb_no];
}
}
自动提取摘要,自动提取第一张图片 思路
最新推荐文章于 2021-05-24 15:25:51 发布