zoukankan      html  css  js  c++  java
  • PHP fgetss() 函数

    定义和用法

    fgetss() 函数从打开的文件中返回一行,并过滤掉 HTML 和 PHP 标签。

    fgetss() 函数会在到达指定长度或读到文件末尾(EOF)时(以先到者为准),停止返回一个新行。

    如果失败该函数返回 FALSE。

    语法

    fgetss(file,length,tags)
    参数描述
    file 必需。规定要检查的文件。
    length 可选。规定要读取的字节数。默认是 1024 字节。

    注意:该参数在 PHP 5 之前的版本是必需的。

    tags 可选。指定哪些标记不被去掉。

    实例

    实例 1

    test.html 代码内容:

    <p><b>This is a paragraph.</b></p>

    PHP 代码:

    <?php
    $file = fopen("test.html","r");
    echo fgetss($file);
    fclose($file);
    ?>

    上面的代码将输出:

    This is a paragraph.

    实例 2

    <?php
    $file = fopen("test.html","r");
    echo fgetss($file,1024,"<p>,<b>");
    fclose($file);
    ?>

    上面的代码将输出:

    This is a paragraph.

    上面输出的源代码是:高佣联盟 www.cgewang.com

    <p><b>This is a paragraph.</b></p>

     

  • 相关阅读:
    Networking
    Table of Contents
    Table of Contents
    Jersey(1.19.1)
    Jersey(1.19.1)
    11.Container With Most Water---两指针
    85.Maximal Rectangle---dp
    42.Trapping Rain Water---dp,stack,两指针
    84.Largest Rectangle in histogram---stack
    174.Dungeon Game---dp
  • 原文地址:https://www.cnblogs.com/yc10086/p/13021951.html
Copyright © 2011-2022 走看看