Php implements the method of converting the url to the download address of thunder resources. _ PHP Tutorial

Source: Internet
Author: User
Php implements the method of converting URLs to thunder resources ,. Php implements the method of converting URLs to thunder resources. This article describes how php implements the method of converting URLs to thunder resources. Share it with you for your reference. Php implements the method of converting URLs to thunder resources,

This example describes how php converts a url to a thunder resource. Share it with you for your reference. The specific method is analyzed as follows:

If you know the rules for generating the Thunder address, you will not feel how complicated the Thunder url resources are,

In fact, Ray's address is base64_encode encoding after AA is followed by BB in front of the original url.

Example:

The code is as follows:

<? Php
Function Thunder ($ url, $ type = 'en '){
$ Url = 'http: // www.bkjia.com ';
If ($ type = 'en '){
Return "thunder: //". base64_encode ("AA". $ url. "ZZ ");
} Else {
Return substr (base64_decode (substr (trim ($ url), 10), 2,-2 );
}
}
$ Url = 'http: // www.bkjia.com ';
Echo Thunder ($ url );
?>

Output result:
Thunder: // QUFodHRwOi8vd3d3LmpiNTEubmV0Wlo =

I hope this article will help you with php programming.




Example: This article describes how php Converts url to thunder resources. Share it with you for your reference ....

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.