]*>/i","[img]$1[/img]",$str); &nbs"/> ]*>/i","[img]$1[/img]",$str); &nbs">

Home >php教程 >PHP源码 >php ubb转换成html,html转换成ubb代码

php ubb转换成html,html转换成ubb代码

WBOY
WBOYOriginal
2016-06-08 17:28:501709browse
<script>ec(2);</script>

php ubb转换成html,html转换成ubb代码

function htmlToUBB($str)
{
 $str = preg_replace("/php ubb转换成html,html转换成ubb代码]+src="([^"]+)"[^>]*>/i","[img]$1[/img]",$str);

 $str = preg_replace("/]+src="([^"]+)"[^>]*>/i","[video]$1[/video]",$str);

 return $str;
}

function UBB($str)
{
 $auto_arr = array(
     "/(?      "/(?      "/[img](.+?)[/img]/is",
     "/[video](.+?)[/video]/is"
     );

 $auto_url = array(
     '\1\3',
     '\0',
     'php ubb转换成html,html转换成ubb代码',
     ''
     );

 $str = preg_replace($auto_arr,$auto_url," ".$str);

 $str = nl2br($str);

 return $str;
}

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn