简体   繁体   中英

Decode base64 mixed with html In PHP

I'm using base64_decode in php in order to decode a message content. My message content is mixed with html, english and base64 encoding

Is there any way to decode the message to plain html?

example:

 <div dir=3D"ltr">
   <div dir=3D"rtl">=D7=94=D7=90=D7=9D =D7=99=D7=A9 =D7=97=D7=
=93=D7=A9 =D7=91=D7=A0=D7=95=D7=A9=D7=90?<br clear=3D"all"></div> 
   <div>DNS ==D7=9B=D7=91=D7=A8 =D7=A2=D7=95=D7=93=D7=9B=D7=9F.</div>
 </div>

found the simple solution, used two decoding methods.

  quoted_printable_decode(base64_decode($trim4));
  quoted_printable_decode($trim4);

Just run the php command:

base64_decode ( string $data [, bool $strict = FALSE ] ) : string;

After that just generate the html code using Javascript

See php.net documentation

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM