• 欢迎访问搞代码网站,推荐使用最新版火狐浏览器和Chrome浏览器访问本网站!
  • 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏搞代码吧

PHP-HtmlTransferCode_PHP

php 搞代码 4年前 (2022-01-25) 26次浏览 已收录 0个评论

PHP – Html Transfer Code超文本转换码,市面上这东西已经很滥(多)了,不过是这几天自己实践了一下~~~~

支持 多重嵌套 和 同标签嵌套,混合高亮显示(还有一点小问题)

自我感觉便于修改和扩充~~~~~~~~~~~

<?php
/**************************************************
* *
* Name : Functions 4 Html Transfer Code (HTC) *
* Version : 1.3.2 *
* Author : Windy_sk *
* Create : 2003-09-03 *
* Modified: 2003-12-17 *
* Email : [email protected] *
* HomePage: None (Maybe Soon) *
* Notice : U Can Use & Modify it freely, *
* BUT PLEASE HOLD THIS ITEM. *
* *
**************************************************/

$htc_list = array(
“B” => “\\1“,
“I” => “\\1“,
“U” => “\\1“,
“CENTER” => “\\1\n”,
“URL” => “\\1”,
“EMAIL” => “\\1”,
“IMAGE” => “

parseInt(this.offsetParent.offsetWidth))?this.offsetParent.offsetWidth:org_w’%20onclick=’window.open(this.src)’%20style=’cursor:pointer’%20/>

\n”,
%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20″DOWNLOAD”%20%20%20%20%20%20%20%20=>%20″exec:get_dl_html(‘\\1’)”,
%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20″LIST”%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20=>%20″exec:get_list_html(‘\\1’)”,
%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20″QUOTE”%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20=>%20″

%20%20引用:
\\1

\n”,
%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20″IFRAME”%20%20%20%20%20%20%20%20=>%20″

<iframe%20src=’\\1’%20frameborder=’0’%20allowtransparency=’true’%20scrolling=’yes’%20width=’400’%20height=’300′></iframe>

\n”,
%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20″MOVE”%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20=>%20″<marquee%20width=’90%’%20behavior=’alternate’%20scrollamount=’3′>\\1</marquee>\n”,
%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20″GLOW”%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20=>%20″

\\1

\n”,
%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20″SHADOW”%20%20%20%20%20%20%20%20=>%20″

\\1

\n”,
%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20″DROPSHADOW”%20%20%20%20%20%20%20%20=>%20″

\\1

\n”,
%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20″GBMUSIC”%20%20%20%20%20%20%20%20=>%20″\n”,
%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20″MUSIC”%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20=>%20″


Download%20The%20Music
\n”,%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20
%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20″FLASH”%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20=>%20″

\n”,
%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20″SHOCKWAVE”%20%20%20%20%20%20%20%20=>%20″

\n”,
%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20″QUICKTIME”%20%20%20%20%20%20%20%20=>%20″

Download%20The%20Movie

\n”,
%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20″REALPLAYER”%20%20%20%20%20%20%20%20=>%20″


Download%20The%20Movie
\n”,
%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20″MEDIAPLAYER”%20%20%20%20%20%20%20%20=>%20″

Download%20The%20Movie

\n”,
%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20″VOTE”%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20=>%20″exec:get_vote_html(‘\\1’)”,
%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20);

$htc_list_att%20=%20array(
%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20″ALIGN”%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20=>%20″

\\2

\n”,
%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20″URL”%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20=>%20″\\2″,
%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20″EMAIL”%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20=>%20″\\2″,
%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20″IMAGE”%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20=>%20″

parseInt(this.offsetParent.offsetWidth))?this.offsetParent.offsetWidth:org_w;’%20onclick=’window.open(this.src)’%20style=’cursor:pointer’%20/>

\n”,
%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20″FONTFACE”%20%20%20%20%20%20%20%20=>%20″\\2“,
%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20″FONTSIZE”%20%20%20%20%20%20%20%20=>%20″\\2“,
%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20″FONTCOLOR”%20%20%20%20%20%20%20%20=>%20″\\2“,
%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20″DOWNLOAD”%20%20%20%20%20%20%20%20=>%20″exec:get_dl_html(‘\\1′,%20’\\2’)”,
%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20″LIST”%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20=>%20″exec:get_list_html(‘\\2′,’\\1’)”,
%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20″ATTACH”%20%20%20%20%20%20%20%20=>%20″exec:get_attach_html(‘\\2′,%20’\\1’)”,
%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20″VOTE”%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20=>%20″exec:get_vote_html(‘\\1′,’\\2’)”,
%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20);
%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20
$htc_list_spl%20=%20array(
%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20″PHP”%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20=>%20″exec:get_highlight_html(‘\\1′,%20’php’)”,
%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20″CSS”%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20=>%20″exec:get_highlight_html(‘\\1′,%20’css’)”,
%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20″HTML”%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20=>%20″exec:get_highlight_html(‘\\1′,%20’html’)”,
%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20″SCRIPT”%20%20%20%20%20%20%20%20=>%20″exec:get_highlight_html(‘\\1′,%20’script’)”,
%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20″CODE”%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20=>%20″exec:get_code_html(‘\\1’)”,
%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20″EXECUTE”%20%20%20%20%20%20%20%20=>%20″\\1″,
%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20);

function%20get_highlight_html($str,%20$type%20=%20″php”)%20{
%20%20%20%20%20%20%20%20$type%20=%20strtolower($type);
%20%20%20%20%20%20%20%20$type_func%20=%20$type.”_highlight”;
%20%20%20%20%20%20%20%20$type%20=%20strtoupper($type);
%20%20%20%20%20%20%20%20$result%20=%20″

“;
%20%20%20%20%20%20%20%20if(!function_exists($type_func))%20$type_func%20=%20″php_highlight”;
%20%20%20%20%20%20%20%20$result%20.=%20″
%20%20%20%20%20%20%20%20

%20%20%20%20%20%20%20%20

%20%20%20%20%20%20%20%20

高亮显示%20{$type}%20代码:
%20%20%20%20%20%20%20%20%20%20

%20%20%20%20%20%20%20%20%20%20″.$type_func($str).”
%20%20%20%20%20%20%20%20%20%20

%20%20%20%20%20%20%20%20″.($type==”HTML”?””:””).”
%20%20%20%20%20%20%20%20
%20%20%20%20%20%20%20%20
%20%20%20%20%20%20%20%20

%20%20%20%20%20%20%20%20″;
%20%20%20%20%20%20%20%20return%20$result;
}

function%20php_highlight($str)%20{
%20%20%20%20%20%20%20%20$str%20=%20str_replace(“\\\””,”\””,$str);
%20%20%20%20%20%20%20%20return%20highlight_string($str,%20true);
}

function%20css_highlight($str,%20$nl%20=%20true)%20{
%20%20%20%20%20%20%20%20$color_1%20=%20″red”;
%20%20%20%20%20%20%20%20$color_2%20=%20″green”;
%20%20%20%20%20%20%20%20$color_3%20=%20″blue”;
%20%20%20%20%20%20%20%20$str%20=%20str_replace(“\\\””,”\””,$str);
%20%20%20%20%20%20%20%20$str%20=%20str_replace(“\r”,%20″”,%20$str);
%20%20%20%20%20%20%20%20preg_match_all(“/[\\\*\.\w#:%20]+\{[^\{\}]+\}/”,%20$str,%20$arr_css);
%20%20%20%20%20%20%20%20$arr_css%20=%20$arr_css[0];
%20%20%20%20%20%20%20%20for($i=0;%20$i<count($arr_css);%20$i++)%20{
%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20$head%20=%20preg_replace(“/([\\\*\.\w#:%20]+\{)[^\{\}]+\}/”,%20″\\1“.($nl?”
\n”:””),%20$arr_css[$i]);
%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20$unit%20=%20preg_replace(“/[\\\*\.\w#:%20]+\{([^\{\}]+)\}/”,%20″\\1″,%20$arr_css[$i]);
%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20$unit_list%20=%20preg_split(“/;\s*/”,%20$unit);
%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20$unit%20=%20″\n”;
%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20for($j=0;%20$j<count($unit_list);%20$j++)%20{
%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20if(strlen($unit_list[$j])>0)
%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20$unit%20.=%20″%20%20%20%20″%20.%20preg_replace(“/\s*([\w\-]+)\s*:\s*(.*)/e”,%20″‘\\1%20:%20‘.htmlspecialchars(‘\\2′).’%20;%20′”,%20$unit_list[$j])%20.%20($nl?”
\n”:”\n”);
%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20}
%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20$arr_css[$i]%20=%20$head%20.%20$unit%20.%20″}“;
%20%20%20%20%20%20%20%20}%20
%20%20%20%20%20%20%20%20return%20join(($nl?”\n

\n”:”\n\n”),%20$arr_css);
}

function%20script_highlight_note($str,%20$mode%20=%20true)%20{
%20%20%20%20%20%20%20%20$color_note%20=%20″gray”;
%20%20%20%20%20%20%20%20$str%20=%20str_replace(“\\\””,”\””,$str);
%20%20%20%20%20%20%20%20$str%20=%20preg_replace(“/(.*)<\/font>/isU”,%20″\\1″,%20$str);
%20%20%20%20%20%20%20%20$str%20=%20$mode?”/*{$str}*/”:”//{$str}”;
%20%20%20%20%20%20%20%20return%20″{$str}“;
}

function%20script_highlight($str,%20$nl%20=%20true)%20{
%20%20%20%20%20%20%20%20$color_1%20=%20″red”;
%20%20%20%20%20%20%20%20$color_2%20=%20″blue”;
%20%20%20%20%20%20%20%20$color_3%20=%20″brown”;
%20%20%20%20%20%20%20%20$color_4%20=%20″green”;
%20%20%20%20%20%20%20%20$str%20=%20str_replace(“\\\””,”\””,$str);
%20%20%20%20%20%20%20%20$str%20=%20htmlspecialchars($str);
%20%20%20%20%20%20%20%20$str%20=%20str_replace(“=”,”&equal;”,$str);
%20%20%20%20%20%20%20%20$str%20=%20str_replace(“|”,”&vertical;”,$str);
%20%20%20%20%20%20%20%20$keywords%20=%20array(
%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20″{$color_1}”%20%20%20%20%20%20%20%20=>%20array(“null”,%20″true”,%20″false”,%20″NaN”),
%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20″{$color_2}”%20%20%20%20%20%20%20%20=>%20array(“var”,%20″for”,%20″if”,%20″else”,%20″switch”,%20″case”,%20″function”,%20″loop”,%20″continue”,%20″break”,%20″<“,%20″>”,%20″!&equal;”,%20″&equal;&equal;”,%20″&equal;”,%20″&&”,%20″&vertical;&vertical;”),
%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20″{$color_3}”%20%20%20%20%20%20%20%20=>%20array(“window”,%20″self”,%20″this”,%20″event”,%20″document”,%20″opener”,%20″Navigator”,%20″Math”,%20″Array”,%20″String”,%20″Object”,%20″Function”,%20″Number”),
%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20);
%20%20%20%20%20%20%20%20foreach($keywords%20as%20$key%20=>%20$value)%20{
%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20for($i=0;%20$i<count($value);%20$i++)%20{
%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20$str%20=%20preg_replace(“/(\W)(“.$value[$i].”)(\W)/”,%20″\\1\\2\\3″,%20$str);
%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20}
%20%20%20%20%20%20%20%20}
%20%20%20%20%20%20%20%20$str%20=%20preg_replace(“/(\.|\s)([a-z]+)\(/i”%20,”\\1\\2(“,%20$str);
%20%20%20%20%20%20%20%20$str%20=%20preg_replace(“/\.(\w+)(?!\()/i”%20,”.\\1“,%20$str);
%20%20%20%20%20%20%20%20$str%20=%20preg_replace(“/\/\/([^\n]*)\n/e”%20,”script_highlight_note(‘\\1’,%20false)”,%20$str);
%20%20%20%20%20%20%20%20$str%20=%20preg_replace(“/\/\*(.*?)\*\//es”%20,”script_highlight_note(‘\\1’)”,%20$str);%20%20%20%20%20%20%20%20
%20%20%20%20%20%20%20%20$str%20=%20str_replace(“\t”,%20″%20%20%20%20″,%20$str);
%20%20%20%20%20%20%20%20$str%20=%20str_replace(“&equal;”,”=”,$str);
%20%20%20%20%20%20%20%20$str%20=%20str_replace(“&vertical;”,”|”,$str);
%20%20%20%20%20%20%20%20return%20$nl?nl2br($str):$str;
}

function%20html_highlight_attr($att)%20{
%20%20%20%20%20%20%20%20$color_1%20=%20″red”;
%20%20%20%20%20%20%20%20$color_2%20=%20″brown”;
%20%20%20%20%20%20%20%20$color_3%20=%20″black”;
%20%20%20%20%20%20%20%20$att%20=%20str_replace(“\\\””,”\””,$att);
%20%20%20%20%20%20%20%20$att%20=%20preg_replace(“/=\s*(‘|\”)([^’\”]+)\\1/eU”,”‘=\\1’.preg_replace(‘/\s+/’,’|:s:|’,’\\2′).’\\1′”,$att);
%20%20%20%20%20%20%20%20$att%20=%20str_replace(“\\\””,”\””,$att);
%20%20%20%20%20%20%20%20$att%20.=%20″%20″;
%20%20%20%20%20%20%20%20preg_match_all(“/[a-z:\/\-]+(=([‘\”]?).*[^\\\\]{1}\\2?)?\s+/iU”,%20$att,%20$att_list);
%20%20%20%20%20%20%20%20$att_list%20=%20$att_list[0];
%20%20%20%20%20%20%20%20for($i=0;%20$i<count($att_list);%20$i++)%20{
%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20if(empty($att_list[$i]))%20continue;
%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20$att_list[$i]%20=%20trim($att_list[$i]);
%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20$att_list[$i]%20=%20preg_replace(“/([^=]+)([=]?)([‘\”]?)(.*)(\\3)/”,%20″\\1\\2\\3\\4\\3″,%20$att_list[$i]);
%20%20%20%20%20%20%20%20}
%20%20%20%20%20%20%20%20return%20str_replace(“|:s:|”,%20″%20″,%20join(“%20”,%20$att_list));
}

function%20html_highlight($str)%20{
%20%20%20%20%20%20%20%20$color_1%20=%20″red”;
%20%20%20%20%20%20%20%20$color_2%20=%20″blue”;
%20%20%20%20%20%20%20%20$color_3%20=%20″gray”;
%20%20%20%20%20%20%20%20$str%20=%20str_replace(“\\\””,”\””,$str);
%20%20%20%20%20%20%20%20preg_match_all(“/<script([^>]*)>(.*)<\/script>/isU”,%20$str,%20$arr_tmp);
%20%20%20%20%20%20%20%20$arr_script%20=%20$arr_tmp[0];
%20%20%20%20%20%20%20%20for($i=0;%20$i<count($arr_script);%20$i++)%20{
%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20$str%20=%20str_replace($arr_script[$i],%20″
::script_{$i}::
“,%20$str);
%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20$arr_script[$i]%20=%20preg_replace(“/<script([^>]*)>(.*)<\/script>/iseU”,%20″‘<SCRIPT%20′.html_highlight_attr(‘\\1′).’>
‘.script_highlight(str_replace(‘\\\”‘,’\”‘,’\\2′),%20false).’</SCRIPT>‘”,%20$arr_script[$i]);
%20%20%20%20%20%20%20%20}
%20%20%20%20%20%20%20%20$str%20=%20preg_replace(“/(

(提示:可以先修改部分代码)

“;
}

function get_list_html($content, $type = “”) {
$content = preg_replace(“/(
)?[\r\n]+/”, “\n”, $content);
$content = preg_replace(“/[\r\n]+/”, “\n”, $content);
$content = preg_replace(“/^[\n]*(.*)[\n]*$/m”, “\\1”, $content);
$content = str_replace(“\n”, “

  • “, $content);
    $content = “
    • $content

    \n”;
    return $content;
    }

    function html_trans($str) {
    $search = array(“&”, “‘”, “\””, “”, ” “, “\t”);
    $replace = array(“&”, “'”, “"”, “<“, “>”, ” “, ” “);
    return nl2br(str_replace($search, $replace, $str));
    }

    function link_url($str) {
    $str = preg_replace(“/((http|ftp|mms|rtsp|pnm|mailto):\/\/[\w@:\.\/\?=&;#\-%]+)/i”, “\\1”, $str);
    $str = preg_replace(“/(\w+@(\w+\.)+[\w]{2,3})/i”, “\\1”, $str);
    $str = preg_replace(“/(href|src)='[^’/iU”, “\\1=\\2”, $str);
    return $str;
    }

    function htc2html_loop($str) {
    global $htc_list, $htc_list_att;
    foreach($htc_list as $key => $value) {
    if(substr($value,0,5)==”exec:”){
    $str = preg_replace(“/\[$key\]((.(?!\[$key(\s?=\s?([^\]]+))?\]))*)\[\/$key\]/iexsU”, substr($value,5), $str);
    } else {
    $str = preg_replace(“/\[$key\]((.(?!\[$key(\s?=\s?([^\]]+))?\]))*?)\[\/$key\]/ixsU”, “$value”, $str);
    }
    }
    foreach($htc_list_att as $key => $value) {
    if(substr($value,0,5)==”exec:”){
    $str = preg_replace(“/\[$key\s?=\s?([^\]]+)\]((.(?!\[$key(\s?=\s?([^\]]+))?\]))*)\[\/$key\]/iesxU”, substr($value,5), $str);
    } else {
    $str = preg_replace(“/\[$key\s?=\s?([^\]]+)\]((.(?!\[$key(\s?=\s?([^\]]+))?\]))*)\[\/$key\]/isxU”, “$value”, $str);
    }
    }
    return $str;
    }

    function htc2html($str, $trans_url = true , $loop = 3) {
    global $htc_list_spl;
    $str = preg_replace(“/(\[\w+\])\s*/ixs”,”\\1″,$str);
    $str = preg_replace(“/\s*(\[\/\w+\])/ixs”,”\\1″,$str);
    foreach($htc_list_spl as $key => $value) {
    preg_match_all(“/\[$key\](.*)\[\/$key\]/ixsU”, $str, $arr_tmp);
    $arr_spl[$key] = $arr_tmp[0];
    for($i=0; $i<count($arr_spl[$key]); $i++) {
    $str = str_replace($arr_spl[$key][$i], “
    ::{$key}_{$i}::
    “, $str);
    if(substr($value,0,5)==”exec:”){
    $arr_spl[$key][$i] = preg_replace(“/\[$key\](.*)\[\/$key\]/iexsU”, substr($value,5), $arr_spl[$key][$i]);
    } else {
    $arr_spl[$key][$i] = preg_replace(“/\[$key\](.*)\[\/$key\]/ixsU”, “$value”, $arr_spl[$key][$i]);
    }
    }
    }
    $str = html_trans($str);
    while($loop– > 0) {
    if(!preg_match(“/\[(\w+)(\s?=\s?([^\]]+))?\](.*)\[\/\\1\]/isU”, $str)) break;
    $str = htc2html_loop($str);
    }
    if($trans_url) $str = link_url($str);
    foreach($htc_list_spl as $key => $value) {
    for($i=0; $i<count($arr_spl[$key]); $i++) {
    $str = str_replace(“
    ::{$key}_{$i}::
    “, $arr_spl[$key][$i], $str);
    }
    }
    return $str;
    }
    ?>

    使用方法:

    echo htc2html($str);

    OK 了~~~~~~~~


    搞代码网(gaodaima.com)提供的所有资源部分来自互联网,如果有侵犯您的版权或其他权益,请说明详细缘由并提供版权或权益证明然后发送到邮箱[email protected],我们会在看到邮件的第一时间内为您处理,或直接联系QQ:872152909。本网站采用BY-NC-SA协议进行授权
    转载请注明原文链接:PHP-HtmlTransferCode_PHP

    喜欢 (0)
    [搞代码]
    分享 (0)
  • 发表我的评论
    取消评论

    表情 贴图 加粗 删除线 居中 斜体 签到

    Hi,您需要填写昵称和邮箱!

    • 昵称 (必填)
    • 邮箱 (必填)
    • 网址