PHP check if file is in use

后端 未结 2 814
庸人自扰
庸人自扰 2021-01-12 07:46

I want to make a flat files database which will use .php files to store data from the website. My only problem is that if when I \'select\' something from the flatfile datab

相关标签:
2条回答
  • 2021-01-12 08:17

    Please Try this It worked on my case....

        if(readyToRead(__FILE__)){
            echo "File is ready to read.";
        } else{
            echo "File is used by somebody else.";
        }
    
       function readyToRead($file){
           return ((time() - filemtime($file)) > 5 ) ? true : false;
       }
    
    0 讨论(0)
  • 2021-01-12 08:20

    look into flock() http://php.net/manual/en/function.flock.php

    0 讨论(0)
提交回复
热议问题