相关疑难解决方法(0)

PHP\r \n和\n之间的区别

简单问题......

我看到有人告诉我在各个地方使用"\ r \n",其他人告诉我在同一个地方使用"\n".我确信一个是正确的,一个是错的.示例 - 设计mail()标头时:

教程#1:

//define the headers we want passed. Note that they are separated with \r\n 
$headers = "From: webmaster@example.com\r\nReply-To: webmaster@example.com"; 
//add boundary string and mime type specification 
$headers .= "\r\nContent-Type: multipart/mixed; boundary=\"PHP-mixed-".$random_hash."\""; 
Run Code Online (Sandbox Code Playgroud)

教程#2(注意头参数):

mail($to, $subject, $body, 
    "From: " . $from . "\n" . 
    "bcc: " . $bcc . "\n" . 
    "MIME-Version: 1.0\n" . 
    "Content-Type: multipart/alternative;\n" . 
    "     boundary=" . $mime_boundary_header)
Run Code Online (Sandbox Code Playgroud)

我很困惑,但显然它有点不同,因为有一个,我的标题工作,而另一个,他们有时只工作.

php syntax

17
推荐指数
3
解决办法
4万
查看次数

标签 统计

php ×1

syntax ×1