TAY
笔记 · · 阅读 185
更新于

php markdown 内容提取代码块语言

$pattern = '/```\s*([a-zA-Z]+)\s*\n(.*?)```/s'; // 匹配三个 ` 开头、结尾的行及其之间的任意字符(包括换行)
preg_match_all($pattern, $note->content, $matches);
$result = array_unique($matches[1]);
sort($result);
目录