zoukankan      html  css  js  c++  java
  • 去除HTML标签

    foreach ($list['company_list'] as $key => $value) {

    $list['company_list'][$key]['summary'] =strip_tags($list['company_list'][$key]['summary']);//去除html标签

    $list['company_list'][$key]['summary'] = str_replace(' ',' ', $list['company_list'][$key]['summary']);

     

    单词解说:

     

    strip_tags()函数可以轻松实现从字符串中去除 HTML 和 PHP 标记。

     

    使用方法:

     

    trip_tags ( string $str [, string $allowable_tags ] );

     

    第一个参数为必须的,也就是要去除 HTML 和 PHP标记的源数据,第二个参数是可选的,表示不需要过滤的标记。

    str_replace() 函数使用一个字符串替换字符串中的另一些字符

    语法

    str_replace(find,replace,string,count)
    参数描述
    find 必需。规定要查找的值。
    replace 必需。规定替换 find 中的值的值。
    string 必需。规定被搜索的字符串。
    count 可选。一个变量,对替换数进行计数。

     

  • 相关阅读:
    皇帝的用人之道,这一点古今皆同
    sharepoint打包
    powershellbegin
    taxonomy
    powershelluninstall webapplication
    面试题
    字符串处理
    在页面中插入视频时的文件夹命名问题
    process object
    扩展名显示与隐藏
  • 原文地址:https://www.cnblogs.com/jiaoda/p/7649082.html
Copyright © 2011-2022 走看看