php Server_MapPath类(方法)实例源码

下面列出了php Server_MapPath 类(方法)源码代码实例,从而了解它的用法。

作者:golfcrseve    项目:scsupe   
function GetResourceTypeDirectory($resourceType, $sCommand)
{
    global $config;
    if ($sCommand == "QuickUpload") {
        if (strlen($config['QuickUploadAbsolutePath'][$resourceType]) > 0) {
            return $config['QuickUploadAbsolutePath'][$resourceType];
        }
        // Map the "UserFiles" path to a local directory.
        return Server_MapPath($config['QuickUploadPath'][$resourceType]);
    } else {
        if (strlen($config['FileTypesAbsolutePath'][$resourceType]) > 0) {
            return $config['FileTypesAbsolutePath'][$resourceType];
        }
        // Map the "UserFiles" path to a local directory.
        return Server_MapPath($config['FileTypesPath'][$resourceType]);
    }
}

作者:BGCX26    项目:zhishuicms-svn-to-gi   
function output_file($cmd, $file_name, $file_dir, $formername, $mime = 'application/octet-stream')
{
    $path = Server_MapPath($file_dir . $file_name);
    if (!file_exists($path)) {
        echo "Îļþ²»´æÔÚ";
        exit;
    } else {
        $file = fopen($path, "r");
        $filesize = filesize($path);
        Header("Content-type: {$mime}");
        Header("Accept-Ranges: bytes");
        Header("Accept-Length: " . $filesize);
        if ($cmd == "download") {
            Header("Content-Disposition: attachment; filename=" . $formername);
        }
        echo fread($file, $filesize);
        fclose($file);
    }
}


问题


面经


文章

微信
公众号

扫码关注公众号