开发者

In 'form action="?login"', what does the question mark mean?

开发者 https://www.devze.com 2023-03-23 09:31 出处:网络
Consider: <form action="?login" method="post"><button>Login with Google</button> </form>

Consider:

<form action="?login" method="post">     <button>Login with Google</button> </form>

I usually see the action refer to a PHP or HTML file, but the "?login" stumps me.

Background information:

This is buried within the example-google.php file from lightopenid framework. I've been staring at the OpenID code to use Google as a开发者_StackOverflow社区 third-party OpenID provider for user login on my web site and the sample code all works.

I am trying to get a clearer picture of what the framework is doing when the user presses the login button. I know that we must be sending a bunch of arguments to Google on this button action, but the ?login doesn’t seem to point anywhere.

http://gitorious.org/lightopenid


A question mark denotes the query string.

It will post to the current URL with a query string parameter of login. I am not sure how you are processing the request after you click submit (post the form), but usually it would have a value assigned to it as in login=value.


It means:

http://whatever/the-current-page-url-is?login (where "login" is the query string).

It is a relative-URI notation, similar to <img src="foo.jpg"> -- note the rest of the URI was not specified explicitly.

Happy coding

0

精彩评论

暂无评论...
验证码 换一张
取 消