以下函数可用于替换php内置的is_writable函数
复制代码 代码如下:
//可用于替换php内置的is_writable函数
function isWritable($filename){
if(preg_match('/\/$/',$filename)){
$tmp_file=sprintf('%s%s.tmp',$filename,uniqid(mt_rand()));
return isWritable($tmp_file);
}
if(file_exists($filename)){
//文件已经存在的话,使用读写方式打开
$fp=@fopen($filename,'r+');
if($fp){
fclose($fp);
return true;
}
else{
return false;
}
}
else{
$fp=@fopen($filename,'w');
if($fp){
fclose($fp);
unlink($filename);
return true;
}
else{
return false;
}
}
}

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Dreamweaver Mac version
Visual web development tools

SublimeText3 English version
Recommended: Win version, supports code prompts!

Notepad++7.3.1
Easy-to-use and free code editor

Atom editor mac version download
The most popular open source editor

SAP NetWeaver Server Adapter for Eclipse
Integrate Eclipse with SAP NetWeaver application server.