另一个提示:两者之间的差异是 subjectStR属性
中的空格我想知道为什么URL中的空格会阻止GET全局变量自动解码所有属性
$message=urlencode($message);
http://localhost/test4.php?me=ahmed&y=1&clientid=55&default=1&Subjectstr=**Email From Contactuspage`**&BodyStr=$message
http://localhost/test4.php?me=ahmed&y=
1&clientid=55&default=1&Subjectstr=**EmailFromContactuspage**&BodyStr=$message
答案 0 :(得分:1)
URL查询字符串中不允许使用空格。如果您在SubjectStr
中放置了未编码的空格,则URL会在该点结束,因此服务器永远不会看到BodyStr
参数。
您需要对SubjectStr
进行网址编码。将空格替换为+
或%20
。
$message=urlencode($message);
$url = "http://localhost/test4.php?me=ahmed&y=1&clientid=55&default=1&Subjectstr=Email+From+Contactuspage&BodyStr=$message"
它在太空停留的原因是因为HTTP协议。客户发送:
GET <url> HTTP/1.1
通过查找URL和HTTP版本令牌之间的空间来解析此请求行。如果URL中有空格,则会将其视为URL的末尾。