/**
* Decode a string with URL-safe Base64.
*
* @paramstring$input A Base64 encoded string
*
* @returnstring A decoded string
*/publicstaticfunctionurlsafeB64Decode($input){$remainder=\strlen($input)%4;if($remainder){$padlen=4-$remainder;$input.=\str_repeat('=',$padlen);}return\base64_decode(\strtr($input,'-_','+/'));}/**
* Encode a string with URL-safe Base64.
*
* @paramstring$input The string you want encoded
*
* @returnstring The base64 encode of what you passed in
*/publicstaticfunctionurlsafeB64Encode($input){return\str_replace('=','',\strtr(\base64_encode($input),'+/','-_'));}
发表评论 取消回复