加验证是否含有标签并去掉标签得到值的函数标签[en][/en]

WBOY
Release: 2016-06-13 13:28:14
Original
755 people have browsed it

求一个加验证是否含有标签并去掉标签得到值的函数标签[en][/en]
我的需求如下
有字符串如一下形势
[en]英文[/en]
[cn]中文[/cn]
当然至于是en还是cn这些标签名我可以自己定义
现在的要求是用PHP判断传入的字符串是否含有指定的标签,如果含有取得标签中值
function filteWord($word,$tag){
  if(含有该标签){
  return '标签中的值';
  }
}

请正则高手完成函数


------解决方案--------------------

PHP code
$word=
                 
              
              
        
            
Copy after login
Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!