[英]After sending a message in Cyrillic from contact form, I receive messages but not in Cyrillic PHP
After sending a message in Cyrillic from contact form, I receive messages but not in Cyrillic. 从联系表以西里尔文发送消息后,我收到了消息,但未收到西里尔文消息。 I try to put a encoding in html, try whats on Stack Overflow, I still can't make it.
我尝试在html中放置编码,尝试在Stack Overflow上进行操作,但仍然无法实现。 Here is the data of my PHP file
这是我的PHP文件的数据
<?php
if(isset($_POST['send'])) {
// Prepare the email
$to = 'mail@abv.bg';
$name = $_POST['name'];
$mail_from = $_POST['email'];
$subject = 'Message sent from website';
$message = $_POST['message'];
$header = "From: $name <$mail_from>";
// Send it
$sent = mail($to, $subject, $message, $header);
if($sent) {
echo 'Вашето съобщение беше изпратено успешно!';
} else {
echo 'Съжаляваме,но вашето съобщение не може да бъде изпратено.';
}
}
?>
Make sure each page (both the form and the action/receiver) use the same encoding (UTF-8, or the extended ASCII you prefer, read https://en.wikipedia.org/wiki/Windows-1251 ). 确保每个页面(表单和操作/接收者)都使用相同的编码(UTF-8或您喜欢的扩展ASCII,请阅读https://en.wikipedia.org/wiki/Windows-1251 )。
In some cases, PHP has a separate user config file (I guess, telling the PHP interpreter among other things, what encoding to use, which somehow ignores the page header). 在某些情况下,PHP有一个单独的用户配置文件(我想,除其他外,告诉PHP解释器要使用哪种编码,而它以某种方式会忽略页面标头)。
So there is a global php.ini
, often inaccessible by users on a shared hosting. 因此,存在一个全局
php.ini
,共享主机上的用户通常无法访问。 There is also a user-based config file, so on your server check for a config file outside the public_html
folder. 还有一个基于用户的配置文件,因此在您的服务器上,请检查
public_html
文件夹之外的配置文件。 I don't remember what the file is called, it's self-descriptive though. 我不记得该文件叫什么,尽管它是自描述的。 Set encoding in that file, then Bob's your auntie.
在该文件中设置编码,然后鲍勃是你的阿姨。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.