首页 \ 问答 \ PHP nl2br()基本功能(PHP nl2br() basic function)

PHP nl2br()基本功能(PHP nl2br() basic function)

有人可以帮我这个邮件脚本。

我只是想发送一封html电子邮件,部分消息来自用户textarea,它放在\ r \ n中。

我似乎无法使用nl2br或任何其他类似的功能。 下面的代码不是我正在使用但仍然产生错误。

代码:

$to  = 'example@gmail.com';

$subject = 'Test Subject';

$message_var_1 = 'test1 \r\n test2 \r\n test3';
$message = nl2br("
    <div>
    <div>$message_var_1</div>
    </div>
");

$headers  = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
$headers .= 'X-Mailer: PHP/'.phpversion() . "\r\n";

mail($to, $subject, $message, $headers);

Can somebody please help me with this mail script.

I'm simply trying to send an html email and part of the message is from a user textarea, which puts in \r\n.

I seem to be unable to use nl2br or any other similar function. The code below isn't what I'm using but still produces the error.

The code:

$to  = 'example@gmail.com';

$subject = 'Test Subject';

$message_var_1 = 'test1 \r\n test2 \r\n test3';
$message = nl2br("
    <div>
    <div>$message_var_1</div>
    </div>
");

$headers  = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
$headers .= 'X-Mailer: PHP/'.phpversion() . "\r\n";

mail($to, $subject, $message, $headers);

原文:https://stackoverflow.com/questions/3396147
更新时间:2022-10-23 21:10

最满意答案

Scrapy本身就是一个框架,它本身不会听任何东西。

您似乎在参考telnet控制台

请参阅TELNETCONSOLE_PORT设置以更改它监听的端口。

这样的事情应该做你想要的:

TELNETCONSOLE_PORT = [80]

Scrapy itself is a framework, it does not listen to anything per-se.

You seem to be refering to the telnet console.

See TELNETCONSOLE_PORT setting to change the port it listens to.

Something like this should do what you want:

TELNETCONSOLE_PORT = [80]

相关问答

更多
  • telnet默认的端口是23啊,80是HTTP端口,你端口号错了当然打不开了 80端口要IIS服务打开了才能telnet上去的,而且返回的是HTTP信息
  • 80端口就是显示一个黑框+闪烁光标的,这说明是通的。 如果不通会显示类似“正在连接127.0.0.1...无法打开到主机的连接。 在端口 81: 连接失败”的消息。 23端口是telnet服务端口,有回显;25、110之类的也是有回显的,如果不是标准的端口一般是没有回显的,通的情况下就是黑框+闪烁光标。 希望可以帮到你。
  • telnet客户端不进行任何特殊处理。 它会在您指定的任何端口上打开与远程服务器的TCP连接,通过此连接转发您键入的任何内容,并将从服务器接收的任何内容放在屏幕上。 当您telnet 127.0.0.1 80它会打开与localhost端口80的连接,通常Web服务器已在监听(在您的情况下为nginx )。 HTTP客户端知道如何制作HTTP请求并通过连接发送它。 telnet客户端对HTTP没有任何了解,但是如果你知道协议,你可以手动制作请求并输入它, telnet客户端将很乐意通过连接发送给你。 如果另 ...
  • 你有简单的错字: start_request() vs start_requests() 你还有另一个错字extract.first() 这是工作代码: import scrapy from scrapy_splash import SplashRequest class Demo_js_pider(scrapy.Spider): name = 'jsdemo' def start_requests(self): yield SplashRequest( ...
  • 如果在Unix上,你需要root权限才能运行1024以下端口的服务。要获得更完整的答案,请参阅https://serverfault.com/questions/38461/is-there-still-a-reason-why-binding-to-端口1024是只授权换根上 If on Unix you need to be root to run a service with port under 1024 For a more complete answer see https://serverfa ...
  • Scrapy本身就是一个框架,它本身不会听任何东西。 您似乎在参考telnet控制台 。 请参阅TELNETCONSOLE_PORT设置以更改它监听的端口。 这样的事情应该做你想要的: TELNETCONSOLE_PORT = [80] Scrapy itself is a framework, it does not listen to anything per-se. You seem to be refering to the telnet console. See TELNETCONSOLE_PO ...
  • 显然,您的计算机上没有本地运行的telnet服务器。 要了解telnet命令的工作原理,您可以执行下一步: telnet debra.dgbt.doc.ca telnet example.com 80 Apparently you don't have telnet server running locally, at your machine. To have a look how telnet command works, you could do next: telnet debra.dgbt.doc ...

相关文章

更多

最新问答

更多
  • 您如何使用git diff文件,并将其应用于同一存储库的副本的本地分支?(How do you take a git diff file, and apply it to a local branch that is a copy of the same repository?)
  • 将长浮点值剪切为2个小数点并复制到字符数组(Cut Long Float Value to 2 decimal points and copy to Character Array)
  • OctoberCMS侧边栏不呈现(OctoberCMS Sidebar not rendering)
  • 页面加载后对象是否有资格进行垃圾回收?(Are objects eligible for garbage collection after the page loads?)
  • codeigniter中的语言不能按预期工作(language in codeigniter doesn' t work as expected)
  • 在计算机拍照在哪里进入
  • 使用cin.get()从c ++中的输入流中丢弃不需要的字符(Using cin.get() to discard unwanted characters from the input stream in c++)
  • No for循环将在for循环中运行。(No for loop will run inside for loop. Testing for primes)
  • 单页应用程序:页面重新加载(Single Page Application: page reload)
  • 在循环中选择具有相似模式的列名称(Selecting Column Name With Similar Pattern in a Loop)
  • System.StackOverflow错误(System.StackOverflow error)
  • KnockoutJS未在嵌套模板上应用beforeRemove和afterAdd(KnockoutJS not applying beforeRemove and afterAdd on nested templates)
  • 散列包括方法和/或嵌套属性(Hash include methods and/or nested attributes)
  • android - 如何避免使用Samsung RFS文件系统延迟/冻结?(android - how to avoid lag/freezes with Samsung RFS filesystem?)
  • TensorFlow:基于索引列表创建新张量(TensorFlow: Create a new tensor based on list of indices)
  • 企业安全培训的各项内容
  • 错误:RPC失败;(error: RPC failed; curl transfer closed with outstanding read data remaining)
  • C#类名中允许哪些字符?(What characters are allowed in C# class name?)
  • NumPy:将int64值存储在np.array中并使用dtype float64并将其转换回整数是否安全?(NumPy: Is it safe to store an int64 value in an np.array with dtype float64 and later convert it back to integer?)
  • 注销后如何隐藏导航portlet?(How to hide navigation portlet after logout?)
  • 将多个行和可变行移动到列(moving multiple and variable rows to columns)
  • 提交表单时忽略基础href,而不使用Javascript(ignore base href when submitting form, without using Javascript)
  • 对setOnInfoWindowClickListener的意图(Intent on setOnInfoWindowClickListener)
  • Angular $资源不会改变方法(Angular $resource doesn't change method)
  • 在Angular 5中不是一个函数(is not a function in Angular 5)
  • 如何配置Composite C1以将.m和桌面作为同一站点提供服务(How to configure Composite C1 to serve .m and desktop as the same site)
  • 不适用:悬停在悬停时:在元素之前[复制](Don't apply :hover when hovering on :before element [duplicate])
  • 常见的python rpc和cli接口(Common python rpc and cli interface)
  • Mysql DB单个字段匹配多个其他字段(Mysql DB single field matching to multiple other fields)
  • 产品页面上的Magento Up出售对齐问题(Magento Up sell alignment issue on the products page)