utils.php 324 B

12345678910111213141516
  1. <?php
  2. function Qiniu_Encode($str) // URLSafeBase64Encode
  3. {
  4. $find = array('+', '/');
  5. $replace = array('-', '_');
  6. return str_replace($find, $replace, base64_encode($str));
  7. }
  8. function Qiniu_Decode($str)
  9. {
  10. $find = array('-', '_');
  11. $replace = array('+', '/');
  12. return base64_decode(str_replace($find, $replace, $str));
  13. }