对PHP开发人员的一个很好的建议 [英] A GREAT SUGGESTION TO PHP DEVELOPPERS

查看:58
本文介绍了对PHP开发人员的一个很好的建议的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,


如果有一个选项告诉PHP让用户

管理所有HTTP头而不是发送什么内容会很棒它认为这对程序员来说是好的...


例如当你写的时候:


header( 状态:200 OK);

标题("位置:/ my_internal_redirected_pa​​ge.php");


PHP决定状态将是302移动,忽略状态:

200 OK。 (即:程序员是愚蠢的)...


当fastcgi看到一个相对的

重定向时,我使用PHP作为cgi和mod_fastcgi ; 200 OK状态它自动执行内部

重定向(在某些情况下非常有用,例如隐藏文件URL)。


好​​了,PHP 4.3.4 ,我发现实现这一目标的唯一方法是这个

妙招:


标题(" Location:/my_internal_redirected_pa​​ge.php");

标题(HTTP / 1.0 200 OK);


如果您将位置标题放在HTTP / 1.0 200 OK之后标题PHP

发送302状态而没有Location标题(没有评论)。


这让我想起Micro $ oft程序,它们总是更清楚地了解用户的内容

想要比用户自己做...


如果程序员发送的话,PHP的行为就像micro $ oft一样遗憾

愚蠢的HTTP标头,PHP应该让他做...


所以我认为让程序员发送所有http标头的选项

会很棒,那种不想关心标题的人

不会有麻烦和实验程序员会很开心:)

我想要感谢所有PHP开发人员的出色工作,我希望

他们会考虑这个建议;)


John

PS:我在这里发布了这个建议因为我不知道在哪里发送

它...如果有人知道更好的地方,请告诉我。

Hello,

It would be great if there was an option to tell PHP to let the user
manage all the HTTP headers instead of sending what it thinks is good for
the programmer...

For example when you write:

header("Status: 200 OK");
header("Location: /my_internal_redirected_page.php");

PHP "decides" that the status will be "302 moved", ignoring the "Status:
200 OK" (ie: the programmer is stupid)...

I use PHP as a cgi along with mod_fastcgi, when fastcgi sees a relative
redirection with a "200 OK" status it autaumatically do an internal
redirection (very useful in some cases, to hide a file url for example).

Well, in PHP 4.3.4, the only way I found to achieve this was this
wonderful trick:

header("Location: /my_internal_redirected_page.php");
header("HTTP/1.0 200 OK");

If you put the Location header after the "HTTP/1.0 200 OK" header PHP
sends a 302 status without the Location header (no comment).

That reminds me Micro$oft programs that always know better what the user
wants to do than the user himself...

It is a pity which PHP behaves like micro$oft, if the programmer sends
stupid HTTP headers, PHP should let him do...

So I think that an option to let the programmer send all http headers
would be great, that way people who don''t want to care about headers
won''t have troubles and experimented programmers will be happy :)
I would like to thank all PHP developpers for their great work and I hope
they''ll consider this suggestion ;)


John
PS: I posted this suggestion here because I don''t know where to send
it... If someone knows a better place, please tell me.

推荐答案

of总是比用户自己更了解用户想要做什么的程序...


很可惜PHP表现得像微
oft programs that always know better what the user
wants to do than the user himself...

It is a pity which PHP behaves like micro


oft,如果程序员发送了

愚蠢的HTTP头文件,PHP应该让他做...


所以我认为让程序员发送所有http标题的选项

会很棒,那样不想关心标题的人

不会有麻烦并且经过实验的程序员会很开心:)

我要感谢所有PHP开发人员的出色工作,我希望他们会考虑这个建议。) />


John

PS:我在这里发布了这个建议,因为我不知道在哪里发送

吧。 ..如果有人知道一个更好的地方,请告诉我。
oft, if the programmer sends
stupid HTTP headers, PHP should let him do...

So I think that an option to let the programmer send all http headers
would be great, that way people who don''t want to care about headers
won''t have troubles and experimented programmers will be happy :)
I would like to thank all PHP developpers for their great work and I hope
they''ll consider this suggestion ;)


John
PS: I posted this suggestion here because I don''t know where to send
it... If someone knows a better place, please tell me.


我不推荐你的建议,因为现在,它发送正确的

标题不管你做什么了http标头。例如,如果你

永久地移动了一个文件并且你发送了200 OK,我们就会陷入一个混乱的世界。这就像你正在连接到一个ftp服务器,但是想要伪造他作为

你正在做一个smtp连接...我不知道什么是有用的。如果你使用标题(位置)

,那是因为你的文件在另一个

的地方,所以你不应该发送200 ok,好像请求的文件真的是

,请参阅...


Savut


" John Wellesz" <乔******** @ firstream.net>写在

消息新闻:Xn ********************** @ 213.91.2.138 ...
I dont approuve your suggestion because right now, it send the correct
header fallowing what you are doing with the http header. Exemple, if you
moved a file permanently and you send a 200 OK, we whould be in a world of
mess. It''s like you are connecting to a ftp server but want to fake him as
you are doing a smtp connection... I dont get what whould be useful for. If
you are using header("location"), it''s because your file is on another
place, so you should not send 200 ok as if the file requested is really
here, see...

Savut

"John Wellesz" <jo*****************************@firstream.net> wrote in
message news:Xn**********************@213.91.2.138...
您好,

如果有一个选项可以告诉PHP让用户管理所有HTTP标头而不是发送它认为有用的内容,这将是很棒的
程序员...

例如当你写:

标题(状态:200 OK);
标题(" Location:/ my_internal_redirected_pa​​ge。 PHP");

PHP"决定&状态将是302移动,忽略状态:
200 OK。 (即:程序员是愚蠢的)...

我使用PHP作为cgi和mod_fastcgi,当fastcgi看到相对的
重定向与200 OK时状态它自动执行内部重定向(在某些情况下非常有用,例如隐藏文件URL)。

好吧,在PHP 4.3.4中,我发现实现的唯一方法这就是这个奇妙的伎俩:

标题(Location:/my_internal_redirected_pa​​ge.php");
标题(HTTP / 1.0 200 OK);

如果您将位置标题放在HTTP / 1.0 200 OK之后标题PHP
发送302状态而没有Location标题(没有评论)。

这让我想起Micro
Hello,

It would be great if there was an option to tell PHP to let the user
manage all the HTTP headers instead of sending what it thinks is good for
the programmer...

For example when you write:

header("Status: 200 OK");
header("Location: /my_internal_redirected_page.php");

PHP "decides" that the status will be "302 moved", ignoring the "Status:
200 OK" (ie: the programmer is stupid)...

I use PHP as a cgi along with mod_fastcgi, when fastcgi sees a relative
redirection with a "200 OK" status it autaumatically do an internal
redirection (very useful in some cases, to hide a file url for example).

Well, in PHP 4.3.4, the only way I found to achieve this was this
wonderful trick:

header("Location: /my_internal_redirected_page.php");
header("HTTP/1.0 200 OK");

If you put the Location header after the "HTTP/1.0 200 OK" header PHP
sends a 302 status without the Location header (no comment).

That reminds me Micro


这篇关于对PHP开发人员的一个很好的建议的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆