This is the code I have so far, I wonder if it's correct?
$handle = fopen($file, 'w') or die("can't open file");
$closed = fclose($handle);
while($closed){
    DOAWESOMETHINGS(); // btw I only want to have 开发者_如何转开发this run once for each handle
    $closed = false;
}
Thank you so much!
You can check whether the handle has been closed or not using this statement
if(!is_resource($handle)){
   //Handle closed
}else{
   //Handle still open
}
Therefore, if you need to ensure that fclose has worked before running the next function, you can use this loop:
while(is_resource($handle)){
   //Handle still open
   fclose($handle);
}
do_awesome_things();
Note: You should also use break; to end while loops when you need to. In this instance the loop will not end until the handle is closed.
 
         
                                         
                                         
                                         
                                        ![Interactive visualization of a graph in python [closed]](https://www.devze.com/res/2023/04-10/09/92d32fe8c0d22fb96bd6f6e8b7d1f457.gif) 
                                         
                                         
                                         
                                         加载中,请稍侯......
 加载中,请稍侯......
      
精彩评论