PHP Read CSV and filter by date

前端 未结 6 2096
再見小時候
再見小時候 2021-01-24 08:12

I have the following CSV

Date,Event,Description
24/01/2010,Football,Football practice for all Years.
24/01/2010,Cricket,Cricket Practice for all Years.
25/01/201         


        
6条回答
  •  长发绾君心
    2021-01-24 08:28

    You can spend lot of time trying to traverse each line in csv file, or can try something like that:

    $command = sprintf("grep '%s' -Er %s", date('d/m/Y'), $this->db);
    $result = `$command`;
    

    This example really works and it is really fast!

提交回复
热议问题