PHP generates instances of download links for thunder, express train, and QQ tornado.

Source: Internet
Author: User
We will use base64_encode and base64_decode to generate download links for thunder, express train, and QQ tornado in php. we will look at two examples below to help you. in some resource download sharing sites, I... we will use base64_encode and base64_decode to generate download links for thunder, express train, and QQ tornado in php. we will look at two examples below to help you.

In some resource download sharing sites, we often encounter the need to add various download tool links on the download page, the traditional use of the download tool official script (. js). Its drawbacks have become increasingly prominent, such as slow loading and client compatibility issues.

This article describes how to use PHP functions to easily generate link data for various third-party download tools and directly output the data to the front-end.

PHP functions used by this function:

1. base64_encode: used to encrypt strings in base64 mode.

2. base64_decode: used to decrypt strings encrypted in base64 mode.

Example 1: Download the PHP code from the original third-party tool:

$ Url = 'http: // www.example.com/document.zip'; // you can refer to the following code to find the exact structure of the download links of various third-party tools: $ url_thunder = 'Thunder ://'. base64_encode ('A '. $ url. 'zz '); $ url_flashget = 'flashget ://'. base64_encode ('[FLASHGET]'. $ url. '[FLASHGET]'); $ url_qqdl = 'qqdl ://'. base64_encode ($ url); restores the original link PHP code from the third-party tool Download link: $ url_old = ''; // separate the string with a slash (//). $ temp = explode ('//', $ url_old, 2); // determine the character before // (converted to lowercase) switch (strtolower ($ temp [0]) {case 'Thunder: ': $ url_new = substr (base64_decode ($ temp [1]), 2,-2); break; case 'flashget: ': $ url_new = substr (base64_decode ($ temp [1]), 10,-10); break; case 'qqdl :': $ url_new = base64_decode ($ temp [1]); break ;}

Example 2: The code is as follows:

   

Actual address: "target =" _ blank ">

Thunder chain: "target =" _ blank ">

Express link: "target =" _ blank ">

Tornado chain: "target =" _ blank ">


Tutorial link:

Reprint at will ~ However, please keep the tutorial address★

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.