文章来源(hbsjsd.cn)湖北高端网站定制开发公司-速建时代
在 项目下/extend/Parsedown.php创建 Parsedown.php
文件
解析文件内容
function text($text) { $Elements = $this->textElements($text); # convert to markup $markup = $this->elements($Elements); # trim line breaks $markup = trim($markup, "\n"); return $markup; }
全部文件下载
后端调用方法引入
use Parsedown
$content="要解析的内容"; $Parsedown = new Parsedown();//实例化$bodyParse = $Parsedown->text($content); //调用解析$choices=['role'=>'assistant','content'=>"$content"];//返回前端
来源:thinkphp6 后端解析markdown标签内容 (hbsjsd.cn)
[声明]原创不易,请转发者备注下文章来源(hbsjsd.cn)【速建时代】。