Home Backend Development PHP Tutorial 新手有几个问题大家

新手有几个问题大家

Jun 13, 2016 am 10:46 AM
basename content fn header pathinfo

新手有几个小问题求助大家!
首先说明一下情况,我写的PHP的基本功能有显示目录下文件,可以上传下载,可以点击查看,可以返回上一目录。
1,header下载功能只能在根目录下载文件,根目录下子目录里的文件下载不了,怎么改才能下载子目录下的东西?
2,怎么创建一个按钮或链接,使得点击后退为上一个页面。
3,怎么限制只能查看根目录下的东西,不能返回根目录的上一级目录。
  希望高手用代码指点,文字说明我看了还是不会写.......回答就有分!

------解决方案--------------------
解决不了,回一帖,希望有高人来指点,我也想学,看了几天实在看不懂……
------解决方案--------------------
2:这个是要分页的。。。
------解决方案--------------------
你打算让人家给你写一个吗?

你贴出你需要修改的代码,让大伙提提意见才对
------解决方案--------------------
把代码贴出来吧
------解决方案--------------------
if(!empty($_GET[fn])){
//---------------------------------------下载--------------------------------------------------

 $fn=$_GET['fn'];
$basename=pathinfo($fn,PATHINFO_BASENAME);
ob_end_clean();
header('Content-Encoding: none');
header('Content-Type: text/plain');
header('Content-Length: '.filesize($fn));
header('Content-Disposition: attachment; filename="'.$basename.'"');
readfile($fn);
exit();

}

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

How to lock and unlock the Function (Fn) key in Windows 11 How to lock and unlock the Function (Fn) key in Windows 11 May 01, 2023 pm 05:22 PM

The top row of the keyboard is populated with function (F1, F2, F3, etc.) keys, which often do double duty as both multimedia keys and designated keys. However, some users have been wondering how Windows 11 Function (Fn) Key Lock works. Function keys, or F-keys, are a great way to perform some quick actions, and with each key playing multiple roles, it makes things even easier. However, this does confuse a group of users who prefer simplicity and simplicity. The best part is that you can always choose whether to use the F keys to perform multimedia changes/modify settings or use them as standard roles. So, let’s understand the concept of function keys and how to lock the Fn key in Windows 11. How do function keys work?

Different ways to lock and unlock the Fn key in Windows 10 and 11 Different ways to lock and unlock the Fn key in Windows 10 and 11 Apr 14, 2023 pm 12:49 PM

How the Fn Key Works with Function Keys The Fn key on your keyboard is basically similar to the Shift and CapsLock buttons. If you create documents frequently, you know how they work: Hold down Shift to capitalize a letter or two, then release it to quickly return to lowercase, while clicking CapsLock lets you write the entire letter in uppercase sentence without holding down another key. This is how Fn works with the standard function keys F1 through F12. When not using Fn

What does the fn+esc key mean? What does the fn+esc key mean? Mar 24, 2023 pm 01:51 PM

The fn+esc key means "lock function key". For example, some notebook keyboards set the F1 key and Fn together to achieve the mute function. After you press "fn+esc" together, when you press F1 again, no need Press Fn again to implement the mute function.

How to lock or unlock function keys in Windows 11/10 How to lock or unlock function keys in Windows 11/10 Apr 20, 2023 am 11:37 AM

Function keys on your keyboard generally work in two ways. These F-series keys from F1 to F12 have general uses in addition to meeting multimedia requirements. In general, this feature not only makes the keyboard more compact, but it doesn't sacrifice anything! It's very easy to use the Fn key combination. Example – F5 key used as refresh button on browser. Pressing the F5 key should refresh the web page you have open on your browser. Apart from this, this F5 key can also be used as a stop button for multimedia purposes. These functions can be toggled with two types of keys. 1.Fn Key 2.F Lock Key We have discussed the key and how to use it. Using the Fn Key Normally, all keyboards with composite keys come with this Fn or function key. So, if your keyboard has F

How does SpringBoot pass parameters in the Header through Feign calls? How does SpringBoot pass parameters in the Header through Feign calls? May 16, 2023 pm 08:38 PM

[SpringBoot] Passing parameters in the Header through Feign calls How to pass Header parameters through Feign Problem description When we use Feign to request the Api interface of another service in Spring Cloud, there is a need to pass the parameters in the Header. If no special processing is done, it will The parameters in the Header will be lost. Solution 1: Pass it through @RequestHeader(name="headerName"). For example: Feign is defined as follows @FeignClient(name="service-name")pub

What does linux header mean? What does linux header mean? Jul 18, 2023 pm 03:34 PM

The Linux header refers to the beginning of a file or data stream, which is used to contain metadata about the content. By correctly writing and using Header files, developers can better utilize system resources and improve code readability and Maintainability.

How to use PHP header() method to adjust web pages How to use PHP header() method to adjust web pages Mar 28, 2023 pm 01:54 PM

PHP is a powerful programming language that can be used to create dynamic websites and web applications. One of the most powerful features is PHP’s header() method. In this article, we will explore how to use PHP’s header() method to adjust web pages.

How to jump in php header How to jump in php header Dec 02, 2022 am 09:14 AM

How to implement jump in php header: 1. Use "Header("Location:$url");" syntax to implement jump; 2. Use if judgment to implement jump, with jump statements such as "if($_COOKIE[" u_type"]){ header('location:register.php'); } else{ setcookie('u_type','1','86400*360');".

See all articles