$ _SERVER ['PATH_INFO']和$ _SERVER ['ORIG_PATH_INFO']有什么区别? [英] What is the difference between $_SERVER['PATH_INFO'] and $_SERVER['ORIG_PATH_INFO']?

查看:92
本文介绍了$ _SERVER ['PATH_INFO']和$ _SERVER ['ORIG_PATH_INFO']有什么区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

$_SERVER['PATH_INFO']$_SERVER['ORIG_PATH_INFO']有什么区别?我该如何使用它们?

当我运行print_r($_SERVER)时,数组中不存在PATH_INFOORIG_PATH_INFO.为什么不?如何启用它们?

我已经阅读了有关它们的PHP手册,但仍然不理解它们.

解决方案

仅当您调用如下PHP脚本时,才会出现PATH_INFO变量:

http://www.example.com/phpinfo.php/HELLO_THERE

它只是.php脚本之后的/HELLO_THERE部分.如果您不这样调用URL,则不会有$_SERVER["PATH_INFO"]环境变量.

PORIG_前缀有点不常见. PATH_INFO是标准的CGI环境变量,并且绝对不能带前缀.你在哪儿读的? (如果您通过cgi-bin/调用PHP解释器,则PHP3/PHP4周围会有一些问题-但今天几乎没有人有这样的设置.)

供参考: http://www.ietf.org/rfc/rfc3875

What’s the difference between $_SERVER['PATH_INFO'] and $_SERVER['ORIG_PATH_INFO']? How do I use them?

When I run print_r($_SERVER), PATH_INFO and ORIG_PATH_INFO are not present in the array. Why not? How can I enable them?

I have read the PHP manual on them, but still don’t understand them.

解决方案

The PATH_INFO variable is only present if you invoke a PHP script like this:

http://www.example.com/phpinfo.php/HELLO_THERE

It's only the /HELLO_THERE part after the .php script. If you don't invoke the URL like that, there won't be a $_SERVER["PATH_INFO"] environment variable.

The PORIG_ prefix is somewhat uncommon. PATH_INFO is a standard CGI-environment variable, and should never be prefixed. Where did you read that? (There were some issues around PHP3/PHP4 if you invoked the PHP interpreter via cgi-bin/ - but hardly anyone has such setups today.)

For reference: http://www.ietf.org/rfc/rfc3875

这篇关于$ _SERVER ['PATH_INFO']和$ _SERVER ['ORIG_PATH_INFO']有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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