PHP的header()函数中的CRLF(\\\ n) [英] CRLF (\r\n) in PHP's header() function
本文介绍了PHP的header()函数中的CRLF(\\\ n)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
为什么/何时必须在PHP的标题末尾使用CRLF?
这是一个例子(它不一定正确):
Why/when does one has to use CRLF's at the end of header in PHP? Here is one example (it's not necessarily correct):
header("method: POST\r\n");
header('Host: '.get_option('transact_url')."\r\n");
header('Content-type: application/x-www-form-urlencoded');
header('Content-length: '.strlen($transaction)."\r\n");
header($transaction."\r\n\r\n");
header("Connection: close\r\n\r\n");
header("Location: ".$key_client_url."\r\n");
推荐答案
你绝不应该在
You should never do manual line-breaks inside of header(). The current implementation removes line-breaks so you're safe, but this could change in future (although there's no reason why it should be changed).
这篇关于PHP的header()函数中的CRLF(\\\ n)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文