⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 08c11-2.php

📁 介绍PHP5的给类型函数应用
💻 PHP
字号:
<?php// For safety, we need to make sure that the file passed in does not// start with a '/', nor does it ever contain '..'.  This way we// can ensure that someone doesn't use this to leave the document tree:$file = $_GET['file'];if (($file{0} == '/') || (strstr($file, '..') !== false)) {	exit("ERROR: Attempt to navigate directory tree detected!");}// Now we need to try to detect the file type from the ending provided// so that we can return the proper Content-Type:$parts = pathinfo($file);switch (strtolower($parts['extension'])) {	case 'gif':		header('Content-type: image/gif');		break;	case 'jpg':	case 'jpeg':		header('Content-type: image/jpeg');		break;	case 'png':		header('Content-type: image/png');		break;	case 'html':		header('Content-type: text/html');		break;	default:		exit("ERROR: Unsupported filetype accessed!");}// If we made it this far, then go ahead and return the file:readgzfile("{$file}.gz");?>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -