function domainReplace($text, $url){ $pattern = "/<[img|IMG].*?src=[\'|\"](.*?(?:[\.jpg|\.jpeg|\.png|\.gif|\.bmp]))[\'|\"].*?[\/]?>/"; $text = stripSlashes($text); return preg_replace_callback($pattern, function($matches) use($url) { if ('/' !== substr($matches[1], 0, 1) && 'http' !== substr($matches[1], 0, 4)) { return str_replace($matches[1], $url . $matches[1], $matches[0]); } return $matches[0]; }, $text); }
帝国cms教程
分享一段帝国cms内容字段文本替换函数
精准像素
2021-09-28
共人阅读
相关推荐
- 帝国CMS函数
-
二次开发中常用的过滤函数
(1)、数字型变量可以用(int)或intval函数处理,例子:$page=(int)$_GET['page'];或$page=intval($_GET['page']);(2)、带小数点的数字型变量可以用(float)或floatval函数处理,例子:$money=(float)$money;或$money=floatval($money);(3)、...
-
帝国CMS在文章内容页添加百度是否已收录查询函数功能
后台帝国CMS收录查询功能截图这个功能之前精准像素www.11px.cn有发过,这次是利用帝国CMS函数的方法。[xxid]17,497[/xxid]找到e/class/userfun.php,在里面添加如下代码://监测百度是否收录function okBaidu($url){$url='http://www.baidu.com/s?wd...
-
评论时间显示刚刚发布插件
使用一个时间转换函数,在时间输出到页面的时候转换一下即可。function TimeTurner($time) {$minute = date("H:i",$time); $hour = date("H:i",$time); $alltime = date...