[英]Convert string to base32 in PHP
I have to pass username as an unique string to a webservice, and the API is asking for the following. 我必须将用户名作为唯一字符串传递给Web服务,并且API要求以下内容。
I cannot find a way to convert the value to BASE16. 我找不到将值转换为BASE16的方法。 PHP does not seem to have a BASE16_ENCODE
like it does for BASE64. PHP似乎不像BASE64那样具有BASE16_ENCODE
。
Example: 例:
$value = <username as an unique string>;
$base16username = base16_encode('$value'); (< Since Base16_encode does not exist, this is my problem)
Google searches are leading me nowhere, nor is the PHP online manual so I suspect I might be overlooking something obvious. Google搜索无处可寻,PHP在线手册也无济于事,所以我怀疑我可能忽略了某些明显的问题。 Any suggestions? 有什么建议么?
Include the package in your composer.json
and use it like so: 将包包含在composer.json
并按如下方式使用它:
$encoded = Base32::encode($string);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.