How to use php to encrypt and decrypt url parameters

Source: Internet
Author: User
How to use php to encrypt and decrypt url parameters? because base64_encode () is generated too long and is too simple, is there any other way?


Reply to discussion (solution)

You can try js:
For example, JavaScript code involves three functions: escape, encodeURI, and encodeURIComponent. the corresponding three decoding functions are: unescape, decodeURI, and decodeURIComponent.

Base64 is only 1/4 longer than the original string
If you still think it is long, you should consider shortening the original string, not the conversion algorithm.
Because even if the original string length can be maintained, it is difficult to ensure that all characters are applicable to URLs.

Base64 is only 1/4 longer than the original string
If you still think it is long, you should consider shortening the original string, not the conversion algorithm.
Because even if the original string length can be maintained, it is difficult to ensure that all characters are applicable to URLs.

The original string specification has been written by the customer and needs to be encrypted. it is impossible to shorten the original string and the original length can only be kept as much as possible. Base64 is only encoded, not encrypted or non-conforming

Base64 is only 1/4 longer than the original string
If you still think it is long, you should consider shortening the original string, not the conversion algorithm.
Because even if the original string length can be maintained, it is difficult to ensure that all characters are applicable to URLs.


This method is good. thank you for your comments.

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.