使用会话变量,饼干与PhoneGap的在iPhone和Android饼干、变量、PhoneGap、iPhone

由网友(心上有座坟)分享简介:我有问题越来越PHP会话变量(如$ _SESSION [用户名])内,通过从PhoneGap的应用程序的Ajax调用PHP发起服务器端code正常工作。I have had problems getting PHP session variables (e.g. $_SESSION['username']) to w...

我有问题越来越PHP会话变量(如$ _SESSION [用户名])内,通过从PhoneGap的应用程序的Ajax调用PHP发起服务器端code正常工作。

I have had problems getting PHP session variables (e.g. $_SESSION['username']) to work within PHP server side code launched via an ajax call from a Phonegap app.

在研究此问题,我发现相互矛盾的意见,以决定是否不会话变量和Cookie都可以使用。

On researching this problem I have found conflicting advice as to whether or not session variables and cookies can be used.

有没有人有一个明确的答案?

Does anyone have a definitive answer?

如果会话变量和Cookie的使用是否有可能已经对他们贡献了不工作的任何问题,我应该知道使用它们?

If session variables and cookies can be used are there any issues I should be aware of in using them that may have contributed to them not working?

我知道,可以启用Cookie用于在iPhone上的PhoneGap的应用程序,但据我所知,没有为Android。

I know that cookies can be enabled for Phonegap apps on an iPhone but as far as I am aware not for Android.

推荐答案

您会好起来,你通常会存储在会话变量中的数据传递到通过JSON你的PhoneGap应用程序,并具有应用商店这种方式。

You would be better off passing the data you would normally store in the session variables to your PhoneGap app via JSON and having the app store it that way.

你可以把它像使用外部API。该应用程序将进行身份验证,并得到一个令牌。这将存储的令牌,并用它来进一步验证请求到服务器进行身份验证。

Think of it like using an external API. The app would authenticate and get back a token. It would store that token and use that to validate further requests to the server were authenticated.

阅读全文

相关推荐

最新文章