PHP 字符串函数

PHP quoted_printable_encode() 函数用于把 8 位字符串转换为 quoted-printable 字符串。

该函数与quoted_printable_decode()相反,与imap_8bit()函数类似。它返回根据 RFC2045 创建的带引号的可打印字符串。

语法

该函数的语法如下:

quoted_printable_encode (string $str) : string

参数

  • str(必须) - 指定要编码的字符串。

返回值

返回编码字符串。

支持的PHP版本

PHP 5.3.0+ 版本

示例

通过下面的例子来了解quoted_printable_encode() 函数的用法

示例1

它将 8 位字符串编码为带引号的可打印字符串。

<?php  
$string = 'Hëllo Guy! Welcome to yxjc123.com';   
echo (quoted_printable_encode($string)); 
?>

浏览器输出:

H=C3=ABllo Guy! Welcome to yxjc123.com

注意:quoted_printable_encode() 函数在邮件系统中用于对任何消息进行编码。我们在接收端使用quoted_printable_decode() 函数解码回字符串。