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

PHP creates desktop shortcut instance, php shortcut instance_PHP tutorial

WBOY
Release: 2016-07-13 10:24:01
Original
1276 people have browsed it

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>; 
Copy after login

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
shortcut

It is common to call
WshShell.CreateShortcut on the Internet, but only IE supports ActiveXObject objects
, so if you want to implement it, you can only run it in the background and return a shortcut
similar to downloading a file
to you I found an example of php

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...
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