在android应用PHP会话摧毁 [英] php session destroyed in android application

查看:182
本文介绍了在android应用PHP会话摧毁的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我建立在Android的登录应用程序中,我打一个网址(用户名和密码),高达的一部分,工作正常,但在那之后,每当我打一个url(一旦用户进行身份验证),它返回任何结果(即一个错误消息像请登录第一)。 然而,它工作正常,在非常相似的iPhone应用程序和浏览器。

I am building a login application in android in which i am hitting a url(with username and password) upto that part it works fine but after that whenever I am hitting a url(once the user is authenticated) , it return nothing(i.e. a error message like please login first). However it works fine in very similar iphone app and on browser.

我不明白什么是真正的问题。有没有(在PHP代码即)在服务器端的任何问题,或者有什么不妥的Andr​​oid应用程序。我们不能责怪实际上在服务器端的代码,因为它工作正常,同样的iPhone应用程序和浏览器。

I could not understand that what is the actual problem. Is there any problem on server side(i.e. in php coding ) or there is something wrong with android app. We cant actually blame the server side coding because it works fine for same iphone app and on browser.

任何想法或帮助将是非常美联社preciated。 谢谢你。

Any idea or help will be highly appreciated. Thanks.

推荐答案

你的PHP脚本使用一个会话令牌,当你通过浏览器浏览网站,以确定访问者。通常游戏其存储在PHPSESSID变量。

Your Php script uses a session token to identify the visitor when you browse the site via a browser. Ususally its stored in a PHPSESSID variable.

如果你希望你的Andr​​oid应用程序,停留在你需要获取的第一个连接后的ID,然后在你的所有后续请求的标头中发送服务器端进行身份验证。

If you want your Android application to stay authenticated on the server side you need to fetch that id after the first connection and then send it in the headers of all your subsequent requests.

*的编辑:* 的这是你想要做什么:<一href="http://stackoverflow.com/questions/3587254/how-do-i-manage-cookies-with-httpclient-in-android-and-or-java">How我在Android中管理Cookie与HttpClient的和/或Java?

*EDIT : * This is what you want to do : How do I manage cookies with HttpClient in Android and/or Java?

这篇关于在android应用PHP会话摧毁的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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