[英]Format mailto link so that PHP can cleanly interpret it
How do I format a mailto:
protocol so that way PHP can interpret it in the following fashion:如何格式化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
)
Currently I've got mailto:test@example.com&subject=The%20Subject&body=Some+test+text.
目前我有mailto:test@example.com&subject=The%20Subject&body=Some+test+text.
though it gets interpreted as:虽然它被解释为:
Array
(
[mailto:test@example_com&subject=The%20Subject&body=Some+test+text_] =>
)
if you are willing to make a small change to the input string, instead of mailto:from@example.com
you are willing to put an equals sign like mailto=from@example.com
then the following code makes it easy:如果您愿意对输入字符串进行小幅更改,而不是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 is: output 是:
Array ( [mailto] => test@example.com [subject] => The Subject [body] => Some test text )
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.