简体   繁体   English

PHP数组,单词之间用逗号分隔

[英]PHP array with words separated by commas

I'm using an array to send form mail. 我正在使用数组发送表格邮件。 The array includes the subject of each field option in the form. 该数组包括表单中每个字段选项的主题。

array("0",""),
array("1","Subject 1a, Text","Subject 1b","Subject 1c"),
array("2","Subject 2a","Subject 2b","Subject 2c")

When the form is delivered to the client, the subject line says "Form: Subject xx". 当表格交付给客户时,主题行显示“表格:主题xx”。

$subject = "Form: ".$value[1]; 

However, if the subject contains a comma as it does in the first example (ie "Subject 1a, Text") the form is delivered with only Form: Subject 1a in the subject field. 但是,如果主题如第一个示例中一样包含逗号(即“主题1a,文本”),则在主题字段中仅以“ 形式:主题1a ”发送表格

It doesn't send the full subject line with the comma and the words after it (ie Form: Subject 1a, Text ). 它不会发送带有逗号和其后的单词的完整主题行(即表格:Subject 1a,Text )。

Any thoughts on what might be going on? 有什么想法吗?

Something like this should work 这样的事情应该工作

iconv_set_encoding("internal_encoding", "UTF-8");

$subject = "Testmail — Special Characters";
$msg = "Hi there,\n\nthis isn’t something easy.\n\nI haven’t thought that it’s that complicated!";

mail(utf8_decode($to), utf8_decode($subject), utf8_decode($msg), utf8_decode($from)."\nContent-    Type: text/plain; charset=UTF-8\nContent-Transfer-Encoding: 8bit\n");?>

Do the encoding/decoding properly. 正确进行编码/解码。 Referred from php mail special characters utf8 PHP邮件引用的特殊字符utf8

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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