当前位置:Gxlcms > PHP教程 > 用php写的将网址转换为超链接的函数

用php写的将网址转换为超链接的函数

时间:2021-07-01 10:21:17 帮助过:4人阅读

  1. function showtext($text){
  2. $search = array('|(http://[^ ]+)|', '|(https://[^ ]+)|', '|(www.[^ ]+)|');
  3. $replace = array('$1', '$1', '$1');
  4. $text = preg_replace($search, $replace, $text);
  5. return $text;
  6. }

人气教程排行