Code代码片断(5do8)

PHPMysqlApacheLinux

新主题
file_get_contents post数...
获取文本内容
php文件写入
检查url网址是否存在
php输出系统状态函数
获取网页中标签之间的数据...
php中的模板替换常用方法
说话自由

首页 » LAMP » PHP »

获取文本内容

标签: file_exists file_get_contents fopen

    public static function GetFileContent($strpath){
        clearstatcache();
        if( !@file_exists($strpath) || !@is_readable($strpath) )return false;
        clearstatcache();
        return @file_get_contents($strpath);
        /*
        if(!$fp = @fopen($strpath, 'r')) return false;
        $contents = "";
        while (!feof($fp)) {
          $contents .= fread($fp, 1024);
        }
        fclose($fp);
        */
    }



读取指定路径的文件内容。

ccdot写于2008-7-14 16:04:09

万不得已不要在代码上加@,影响执行效率且不利于调试.

深空 写于 2008-7-26 10:27:26#1
如果愿意,请留下你观点或者感受...
称呼*
内容*
验证码*