$ _SERVER ['PHP_SELF']不起作用 [英] $_SERVER['PHP_SELF'] not working

查看:286
本文介绍了$ _SERVER ['PHP_SELF']不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果以前有人问过这种问题,我很抱歉。但我花了很多时间寻找,但我找不到解决方案。所以我在这里发布..



问题:
我试图将值发布到同一页面(使用Jquery移动UI)。所以我在页面中使用$ _SERVER ['PHP_SELF']来操作我的表单。请检查拼写行为(为actoin工作,但不适用于行动)



当我在同一页面中使用它时,我很高兴

 < form method =POSTactoin =<?php echo $ _SERVER ['PHP_SELF'];?>> ; 

请检查拼写行为

但是,当我使用这个< form method =POSTaction =<?php echo $ _SERVER ['PHP_SELF'];?>>时,
& code>



它指向我的应用程序的index.php。



任何人都可以告诉我..为什么它发生这样的..请注意,我知道它的错字..



谢谢,

解决方案

问题是 $ _ SERVER ['PHP_SELF'] 返回脚本的名称。您可能的意思是 $ _ SERVER ['REQUEST_URI'] 。它正在处理 actoin ,因为当没有 action 属性时,大多数浏览器都会将它提交到同一页面。 / p>

Im sorry if this kind of question has been asked before. but i spent much time searching for but I could not find the solution. so i'm posting here..

Problem: I'm trying to post the values onto the same page(working with Jquery mobile UI). so I'm using $_SERVER['PHP_SELF'] in action for my form in the page. Please check the spelling for action(working for actoin but not for action)

when i'm using this its posting in the same page and i'm happy

<form method="POST" actoin="<?php echo $_SERVER['PHP_SELF'];?>">

Please check the spelling for action

but, when I'm using this <form method="POST" action="<?php echo $_SERVER['PHP_SELF'];?>">

Its pointing to index.php of my application.

can anyone please tell me..why its happening like this..please note that I know that its typo..

Thanks,

解决方案

The problem is $_SERVER['PHP_SELF'] returns the name of script. You probably mean $_SERVER['REQUEST_URI']. It is working with actoin because most of browsers will submit it to the same page when there is no action attribute.

这篇关于$ _SERVER ['PHP_SELF']不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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