簡體   English   中英

格式化 mailto 鏈接,以便 PHP 可以清楚地解釋它

[英]Format mailto link so that PHP can cleanly interpret it

如何格式化mailto:協議,以便 PHP 可以按以下方式解釋它:

//General PHP test:
print_r($_GET);

//Desired output:
Array
(
 [mailto] => me@example.com
 [subject] => Test Subject
 [body] => Placeholder body example.
 [bcc] => you@example.com
 [cc] => them@example.com
)

目前我有mailto:test@example.com&subject=The%20Subject&body=Some+test+text. 雖然它被解釋為:

Array
(
 [mailto:test@example_com&subject=The%20Subject&body=Some+test+text_] => 
)

如果您願意對輸入字符串進行小幅更改,而不是mailto:from@example.com ,您願意使用等號,例如mailto=from@example.com ,然后以下代碼可以輕松完成:

$querystr = "mailto=test@example.com&subject=The%20Subject&body=Some+test+text";
$array = array();

parse_str($querystr, $array);

print_r($array);

output 是:

Array ( [mailto] => test@example.com [subject] => The Subject [body] => Some test text )

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM