本文整理汇总了PHP中Server_MapPath函数的典型用法代码示例。如果您正苦于以下问题:PHP Server_MapPath函数的具体用法?PHP Server_MapPath怎么用?PHP Server_MapPath使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Server_MapPath函数的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: GetResourceTypeDirectory
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]);
}
}
示例2: output_file
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);
}
}