联系官方销售客服
1835022288
028-61286886
我想重写内容Content类,给每张图片后面加指定字符串,我是这样写的。不起作用,小白自学中,请大神指教一下。谢谢
<?php public function _content_post_before($id, $data, $old) { $content ='<p> <img src="http://xxx.com/uploadfile/ueditor/image/201910/nhg2019102612irgswxg5mcw.jpg" alt="777"/> </p> <img src="http://xxx.com/uploadfile/ueditor/image/201910/nhg2019102612t2p2sqdpfne.jpg" alt="888"/> </p> <p> <img src="http://xxx.com/uploadfile/ueditor/image/201910/nhg2019102612w02qaner5ri.jpg" alt="999"/> </p> <p> <img src="http://xxx.com/uploadfile/ueditor/image/201910/nhg2019102612cvvyc3sysmx.jpg" alt="1010"/> </p> '; preg_match_all("/<[img|IMG].*?src=[\'|\"](.*?(?:[\.gif|\.jpg]))[\'|\"].*?[\/]?>/",$content,$match); $array = $match[0]; foreach ($array as $value) { echo $value."自定义字符串"; } } ?>