PHP check if file is in use

后端 未结 2 813
庸人自扰
庸人自扰 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;
       }
    

提交回复
热议问题