Home >php教程 >php手册 >php将html转成wml的WAP标记语言实例

php将html转成wml的WAP标记语言实例

WBOY
WBOYOriginal
2016-06-06 19:51:33892browse

这篇文章主要介绍了php将html转成wml的WAP标记语言的方法,实例分析了php实现标签的转换与过滤的相关技巧,非常具有实用价值,需要的朋友可以参考下

本文实例讲述了php将html转成wml的WAP标记语言的方法。分享给大家供大家参考。具体实现方法如下:

]*)>/isU", $content, $imgarr); if(isset($imgarr[0]) && count($imgarr[0])>0 ) { foreach($imgarr[0] as $k=>$v) $content = str_replace($v, "WAP-IMG::{$k}", $content); } // 过滤掉样式表和脚本 $content = preg_replace("/

\\n", "", '

'.implode("

\\n

", $content)."

\\n"); //还原图片 if(isset($imgarr[0]) && count($imgarr[0])>0 ) { foreach($imgarr[0] as $k=>$v) { $attstr = (preg_match('#/$#', $imgarr[1][$k])) ? 'php将html转成wml的WAP标记语言实例' : 'php将html转成wml的WAP标记语言实例'; $content = str_replace("WAP-IMG::{$k}", $attstr, $content); } } $content = preg_replace("/&[a-z]{3,10};/isU", ' ', $content); return $content; } function text2wml($content) { $content = str_replace('$', '$$', $content); $content = str_replace("\\r\\n", "\\n", htmlspecialchars($content)); $content = explode("\\n", $content); for ($i = 0; $i
\\n", "", "

".implode("

\\n

", $content)."

\\n"); return $content; } ?>

希望本文所述对大家的php程序设计有所帮助。

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