码迷,mamicode.com
首页 > Web开发 > 详细

PHP操作文件

时间:2019-02-20 12:44:45      阅读:192      评论:0      收藏:0      [点我收藏+]

标签:code   data   public   exit   reboot   操作   fgets   bsp   end   

  public function log()
    {
        $file = fopen(PACK_PATH . "/ProjectImg_1902.log", "r");
        $myfile = fopen(PACK_PATH . "/url.txt", ‘a‘) or die("Unable to open file!");

        while (!feof($file)) {
            $id = trim(str_replace(‘\r‘, ‘‘, fgets($file)));
            $res = strstr($id, ‘www.bozhou.gov.cn‘);
            if (empty($res)) {
                continue;
            } else {
                $start = "data:";
                $end = ";msg";
                $str = $this->get_between($id, $start, $end);
                $data = json_decode($str, true);

                fwrite($myfile, $data[‘picUrl‘] . "\r\n");
                //
            }

        }
        echo ‘code died please reboot‘;
        fclose($myfile);
        exit();
    }

 

PHP操作文件

标签:code   data   public   exit   reboot   操作   fgets   bsp   end   

原文地址:https://www.cnblogs.com/friendwrite/p/10405815.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!