且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

PHP的FTP检查文件夹是否存在总是返回错误创建文件夹

更新时间:2023-11-08 10:52:40

is_dir works only on the local file-system. If you want to check if a ftp-directory already exists try this:

function ftp_is_dir($ftp, $dir)
{
    $pushd = ftp_pwd($ftp);

    if ($pushd !== false && @ftp_chdir($ftp, $dir))
    {
        ftp_chdir($ftp, $pushd);   
        return true;
    }

    return false;
} 

if($id != '') {
    if(ftp_is_dir($conn_id, "../public_html".$tem_pasta['path']."/pics/".$id)) {
    // and so on...

相关阅读

推荐文章