帝国cms6.0如何用字段处理函数图片alt自动加标题,解决方法如下:
把一下代码放入e/userfun.php文件里面
//替换正文IMG里的ALT内容
function user_imgalt($mid, $f, $isadd, $isq, $value, $cs) {
$title = $_POST['title'];
$htmls = $value;
$pattern = "/<img[^>]+>/";
preg_match_all($pattern, $htmls, $matches);
for ($i = 0; $i <= count($matches[0]); $i++) {
preg_match_all("/alt=". + ?"/", $matches[0][$i], $altimg);
$t_alt = count($altimg[0]);
if ($t_alt == 0) {
$htmls = str_replace("<img", "<img alt=" {
$title
}
"", $htmls);
} else {
$htmls = str_replace($altimg[0][0], "alt=" {
$title
}
"", $htmls);
}
}
return $htmls;
}
上面是“帝国CMS6.0如何用字段处理函数图片alt自动加标题”的全面内容,想了解更多关于 帝国cms 内容,请继续关注web建站教程。
当前网址:https://ipkd.cn/webs_1112.html
workflows工作流
荷塘月色ComfyUI工作流
瀑布边坐着一位披着斗篷的隐士
一匹热血沸腾的汗血宝马庄严地站立着ComfyUI工作流
一个20岁丰满的女孩ComfyUI工作流
一条精致透明的朱红色水晶龙
一个可爱的口袋妖怪ComfyUI工作流
泰坦尼克号桌面壁纸上ComfyUI工作流
一位宇航员做在一只乌龟上在星空中游走
猜你喜欢
声明:本站提供的所有资源部分来自互联网,如果有侵犯您的版权或其他权益,请发送到邮箱:admin@ipkd.cn,我们会在看到邮件的第一时间内为您处理!