The following functions can be used to replace PHP's built-in is_writable function
Copy code The code is as follows:
//Can be used to replace PHP's built-in is_writable function
function isWritable($filename){
if(preg_match('//$/',$filename)){
$tmp_file=sprintf('%s%s.tmp',$filename ,uniqid(mt_rand()));
return isWritable($tmp_file);
$fp=@fopen($filename,'r+');
if($fp){
fclose($fp);
return true;
}
else{
; fclose( $fp);
unlink($filename);
return true;
}
else{
return false;
}
}
}
http://www.bkjia.com/PHPjc/327640.html
www.bkjia.com
true
http: //www.bkjia.com/PHPjc/327640.html
TechArticleThe following functions can be used to replace php’s built-in is_writable function. Copy the code. The code is as follows: //Can be used to replace php’s built-in is_writable Function function isWritable($filename){ if(preg_match('//...