Home  >  Article  >  Backend Development  >  PHP creates desktop shortcut instance, php shortcut instance_PHP tutorial

PHP creates desktop shortcut instance, php shortcut instance_PHP tutorial

WBOY
WBOYOriginal
2016-07-13 10:24:011244browse

PHP creates desktop shortcut instance, php shortcut instance

To use php to create desktop shortcut we need to use header, InternetShortcut and some codes that I can’t understand.

Method: Create a new php file, then throw the following code into it, save it as shortcut.php, for example, and place it on the website and directory. The code is as follows:

<span>$shortCut</span> = "<span>[InternetShortcut]  
URL=http://www.baidu.com  
IDList=  
[{000214A0-0000-0000-C000-000000000046}]  
Prop3=19,2  
</span>"<span>;  
</span><span>Header</span>("Content-type: application/octet-stream"<span>);  
</span><span>header</span>("Content-Disposition: attachment; filename=baidu.url;"<span>);  
</span><span>echo</span> <span>$shortCut</span>; 

Use PHP to write a shortcut code for downloading the page to the desktop. After the website is opened, the following problem is displayed. How to solve it?

You have to write a separate page to create the shortcut. I estimate that you have already output the content on the page before, so I am making a mistake

a.php
------ ----------------------------
$url = $_GET['url'];
$filename = urldecode( $_GET['name']);
$filename = iconv('utf-8','GBk',$filename);//Character set conversion
if (!$url || !$filename) exit();
$Shortcut = "[InternetShortcut]
URL={$url}
IDList=
[{000214A0-0000-0000-C000-000000000046}]
Prop3=19 ,2
";
header("Content-type: application/octet-stream");
header("Content-Disposition: attachment; filename={$filename}.url;");
echo $Shortcut;

Make a hyperlink when generating
2e0ad1143a32a48ba2f2bae4be1d6c66shortcut9e32f8f94052860b45a49575b3ca74c8

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/831620.htmlTechArticlePHP creates desktop shortcut instance, php shortcut instance. To use php to create desktop shortcut, we need to use header, InternetShortcut and some codes that I can't understand. Method: New...
Statement:
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