In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
This article will explain in detail how to convert base64 to binary stream in php, Xiaobian thinks it is quite practical, so share it with you as a reference, I hope you can gain something after reading this article.
php base64 to binary stream method: 1, create a PHP sample file;2, by "function base64_to_blob($base64Str){...} "method converts the base64 string to a binary stream.
Operating environment: Windows 7 system, PHP 7.1 version, DELL G3 computer.
php base64 String to binary stream
The code is as follows:
function base64_to_blob($base64Str){ if($index = strpos($base64Str,'base64,',0)){ $blobStr = substr($base64Str,$index+7); $typestr = substr($base64Str,0,$index); preg_match("/^data:(.*);$/ ",$typestr,$arr); return ['blob'=>base64_decode($blobStr),'type'=>$arr[1]]; } return false;}$data = base64_to_blob($base64Str);header('Location: '.$ data['type']);echo $data['blob'];
The strpos() function finds the first occurrence of a string in another string.
The substr() function returns a portion of a string.
base64_decode -Decode data encoded using MIME base64.
About "php base64 how to binary stream" this article is shared here, I hope the above content can be of some help to everyone, so that you can learn more knowledge, if you think the article is good, please share it to let more people see.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.