How to download php native

藏色散人
Release: 2023-02-28 11:12:02
Original
2851 people have browsed it

How to download php native

How to download php natively?

1. Download the html interface source code of the entire web page:

xiazai.php

<html>
<head>
<meta charset ="utf-8">
<title></title>
</head>
<body>
<form method="post" action="xiazai.php">
<input type="submit" name="xz" id="xz" value="下载" />
</form>
</body>
</html>
<?php
//文件下载
//readfile
$filename ="xiazia.php";
if(!empty($_POST["xz"])){
    $fileinfo = pathinfo($filename);
    header(&#39;Content-type: application/x-&#39;.$fileinfo[&#39;extension&#39;]);
    header(&#39;Content-Disposition: attachment; filename=&#39;.$fileinfo[&#39;basename&#39;]);
    header(&#39;Content-Length: &#39;.filesize($filename));
    readfile($thefile);
    exit();
}
?>
Copy after login

The displayed result is: click the download button to download the entire page:

How to download php native

For more PHP related knowledge, please visit PHP Chinese website!

The above is the detailed content of How to download php native. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
php
source:php.cn
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template