未定义变量PHP_SELF [英] Undefined Variable PHP_SELF

查看:158
本文介绍了未定义变量PHP_SELF的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在用php开发一个后端。

I am developing a backend with php here.

我遇到这样的错误有问题:

I am having problem with such error like this:

未定义的变量:PHP_SELF

Undefined variable : PHP_SELF

在我的htdocs目录中。

on my htdocs directory.

我使用php 5.4.4开发,如果你想看看这里的源代码:

I'm developing with php 5.4.4 , and if you want to look at the source code here it is:

http://pastebin.com/xr2PxbNG

推荐答案

Do不使用任何建议的PHP_SELF版本。这是一个安全噩梦,打开了您的PHP以应对多种可能的注射攻击。

Do not use any of the suggested versions of PHP_SELF. It is a security nightmare, opening up your PHP to a multitude of possible injection attacks.

您尝试实现什么?生成表单发送到自己的URL?使用 action = - 这是一种有效的方法,将始终使用发送表单的URL作为加载。

What are you trying to achieve? Generate the URL for a form sending to itself? Use action="" for that - it is a valid approach and will always use the URL for sending the form as for loading.

如果您必须知道请求的脚本,请改用 $ _ SERVER ['SCRIPT_NAME']

If you must know the requested script, use $_SERVER['SCRIPT_NAME'] instead.

这篇关于未定义变量PHP_SELF的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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