Home > Backend Development > PHP Tutorial > PHP url encoding and decoding (encryption/decryption)

PHP url encoding and decoding (encryption/decryption)

WBOY
Release: 2016-07-25 08:55:46
Original
1075 people have browsed it
  1. function base64_url_encode($input) {
  2. return rtrim(strtr(base64_encode($input), '+/', '-'), '=');
  3. }
  4. $code_urlfile = 'test1/test2/1234';
  5. echo base64_url_encode($code_urlfile);
  6. echo '
    '; // bbs.it-home.org
  7. $url = base64_url_encode($code_urlfile);
  8. echo base64_decode($url);
  9. ?>
复制代码

结果:

dGVzdDEvdGVzdDIvMTIzNA test1/test2/1234


source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template