PHP-IMAP 函數可幫助您訪問電子郵件帳戶,IMAP 代表I互聯網M艾爾A訪問權限Protocol 使用這些函數您還可以使用 NNTP、POP3 協議和本地郵箱訪問方法。
這個imap_qprint()函數接受表示 quoted-printable 字符串的字符串值作為參數並將其轉換為 8 位字符串。
用法
imap_qprint($str);
參數
Sr.No | 參數及說明 |
---|---|
1 |
str (Mandatory) 這是一個字符串值,表示用引號括起來的可打印字符串。 |
返回值
此函數返回給定 quoted-printable 字符串的 8 位字符串值。
PHP版本
這個函數最初是在 PHP 版本 4 中引入的,並且適用於所有後續版本。
示例
下麵的例子演示了imap_qprint()字符串 -
<html>
<body>
<?php
$url = "{imap.gmail.com:993/imap/ssl/novalidate-cert}INBOX";
$id = "tutorialspoint.test@gmail.com";
$pwd = "cohondob_123";
$mailbox = imap_open($url, $id, $pwd);
print("Connection established....");
print("<br>");
$qstring = "This 'is a sample text ' with quotes";
$res = imap_qprint($qstring);
print($res);
?>
</body>
</html>
輸出
這會生成以下輸出 -
Connection established.... This 'is a sample text ' with quotes
示例
以下是上述函數的另一個例子 -
<html>
<body>
<?php
//Establishing connection
$url = "{imap.gmail.com:993/imap/ssl/novalidate-cert}INBOX";
$id = "tutorialspoint.test@gmail.com";
$pwd = "cohondob_123";
$imap = imap_open($url, $id, $pwd);
print("Connection established...."."<br>");
//Fetching the contents of a message
print("Contents of the first message:"."<br>");
$body = imap_body($imap, 1);
imap_qprint($body);
//Closing the connection
imap_close($imap);
?>
</body>
</html>
輸出
這會生成以下輸出 -
Connection established.... Contents of the first message: "UTF-8" #sample_mail1 --000000000000a0d34e05b24373f4 Content-Type:text/h
相關用法
- PHP imap_getsubscribed()用法及代碼示例
- PHP imap_header()用法及代碼示例
- PHP imap_last_error()用法及代碼示例
- PHP imap_mutf7_to_utf8()用法及代碼示例
- PHP imap_headerinfo()用法及代碼示例
- PHP imap_lsub()用法及代碼示例
- PHP imap_createmailbox()用法及代碼示例
- PHP imap_fetchtext()用法及代碼示例
- PHP imap_listmailbox()用法及代碼示例
- PHP imap_timeout()用法及代碼示例
- PHP imap_num_msg()用法及代碼示例
- PHP imap_undelete()用法及代碼示例
- PHP imap_mail_move()用法及代碼示例
- PHP imap_status()用法及代碼示例
- PHP imap_utf8_to_mutf7()用法及代碼示例
- PHP imap_clearflag_full()用法及代碼示例
- PHP imap_base64()用法及代碼示例
- PHP imap_close()用法及代碼示例
- PHP imap_listscan()用法及代碼示例
- PHP imap_mail()用法及代碼示例
注:本文由純淨天空篩選整理自 PHP - imap_qprint() Function。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。