简体   繁体   中英

building an app with Phonegap,ajax and php

I want to build an app with php, ajax and phonegap via the following ways: All the client files in the app will be coded with ajax and html while the server side will be in php hosted online. My question is will php session works with phonegap and ajax since the client files will be on phone which makes connections call to php files on server. Will session works from one page to another

Yep, I'm using the jQuery Cookie function to store the PHPSESSID (or whatever), then if your PHP backend stores the session against the user you can do a request to get the user based on the session when the app loads and also send the session with each request.

You also need to enable CORS on the server for the AJAX requests (Much easier than jsonp).

You can also use Local Storage to store the session ID instead of using the cookie plugin.

You can always use the HTML5 localstorage to store data. As far as I know you can't use cookies with Phonegap apps.

Phonegap is framework to build cross app by JS + html + css. It working same the web app. It have more powerful ability to access to many native API: contact, device,.. then in web app haven't. Web app working in browser, Phonegap app(hybrid app) working in WebView(same browser + ability communication with native API - system(Android, IOS, ...)). Everything web app perform then Phonegap app can perform, session or anything.

You can use jsonp in conjunction with HTML5, CSS, and AJAX to accomplish what I believe you are trying.

I used jQuery and am very happy with how our app is shaping up.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM