Home  >  Article  >  Backend Development  >  PHP generates website desktop shortcut code sharing, php shortcut_PHP tutorial

PHP generates website desktop shortcut code sharing, php shortcut_PHP tutorial

WBOY
WBOYOriginal
2016-07-13 10:17:271369browse

PHP generates website desktop shortcut code sharing, php shortcut

It is so simple to generate desktop shortcuts with PHP. When you generate it, just change the website you want to generate.

dianji.html code:

Copy code The code is as follows:

shengcheng.php code:

Copy code The code is as follows:

//Shortcut on the left side of website survival---function

$url = $_GET['url'];

$filename = urldecode($_GET['name']);

$filename = iconv('GBk','utf-8',$filename);//Character set conversion (if there is no need to convert, it will not be converted)

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;

?>

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

is a piece of js code, search JS on Baidu to create a desktop URL shortcut

html code




< meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
Untitled Document