From 52cd510586fa86f824b17fdfe0c322571fd631b8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=B5=AA=E5=AD=90?= Date: Thu, 11 Jul 2024 09:26:39 +0800 Subject: [PATCH] =?UTF-8?q?add=20=E6=96=87=E7=AB=A0=E4=B8=AD=E8=B6=85?= =?UTF-8?q?=E9=93=BE=E6=8E=A5=E6=96=B0=E7=AA=97=E5=8F=A3=E6=89=93=E5=BC=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- functions.php | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/functions.php b/functions.php index fd88d98..846b2e2 100644 --- a/functions.php +++ b/functions.php @@ -70,15 +70,14 @@ function img_postthumb($cid) { return ""; // 没有匹配到图片URL,返回空字符串 } } -//文章目录功能-给文章内标题加上id -function addHeaderLinks($text) -{ +//文章目录功能-给文章内标题加上id+超链接新窗口打开 +function addHeaderLinks($text) { return preg_replace_callback('/(.*?)<\/h\1>/', function ($matches) { $level = $matches[1]; $title = $matches[2]; $id = htmlspecialchars(strip_tags($title), ENT_QUOTES, 'UTF-8'); return sprintf('%s', $level, $id, $id, $title, $title, $level); - }, $text); + }, preg_replace('/', $text)); } //文章最后修改时间 function get_last_modified_time($postId) {