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