php文件函数windows系统编码bug

最近在windows的php环境突然发现windows的php的文件函数文件名都是使用的GBK编码没有使用utf-8编码。于是需要手动转换一下编码。当然了linux系统都是使用的utf-8编码就没有这些问题啦。

我写了一些常用的函数的包装,供大家方便使用

$Server_System;
if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
    $Server_System = 'windows';//filename will be changed into utf-8 in windows
} else {
    $Server_System = 'linux';
}

function my_file_exists($path)
{
    global $Server_System;
    if($Server_System == 'windows')
    {
        $path = iconv('utf-8','gbk',$path);
    }
    return file_exists($path);
}

function my_file_get_contents($path)
{
    global $Server_System;
    if($Server_System == 'windows')
    {
        $path = iconv('utf-8','gbk',$path);
    }
    return file_get_contents($path);
}

function my_filemtime($path)
{
    global $Server_System;
    if($Server_System == 'windows')
    {
        $path = iconv('utf-8','gbk',$path);
    }
    return filemtime($path);
}

function my_file_put_contents($path,$data)
{
    global $Server_System;
    if($Server_System == 'windows')
    {
        $path = iconv('utf-8','gbk',$path);
    }
    return file_put_contents($path,$data);
}

function my_is_dir($path)
{
    global $Server_System;
    if($Server_System == 'windows')
    {
        $path = iconv('utf-8','gbk',$path);
    }

    return is_dir($path);
}

function my_md5_file($path)
{
    global $Server_System;
    if($Server_System == 'windows')
    {
        $path = iconv('utf-8','gbk',$path);
    }
    
    return md5_file($path);
}

function my_sha1_file($path)
{
    global $Server_System;
    if($Server_System == 'windows')
    {
        $path = iconv('utf-8','gbk',$path);
    }
    
    return sha1_file($path);
}

快被bug弄崩溃了

到处都是bug,bug,bug。刚刚修复了那个php CDN的文件编码之类的bug,现在又出来了莫名其妙的调用失败的bug。

做的nodejs的蜘蛛也是被nodejs的异步给恶心到了,嘛,早知道就不用nodejs给自己自找麻烦了,哎,不能实时同步查询数据库简直无情。

神经网络这面的程序也是错误多的好多,莫名其妙的训练不了了……不管了,总之各种操蛋