简体   繁体   English

如何将PHP文件添加到我的Android APK文件?

[英]How do I add PHP files to my android APK file?

I have a web application that uses both localstorage but also server side SQL storage. 我有一个同时使用localstorage和服务器端SQL存储的Web应用程序。 When I test my APK file using Eclipse only the html pages with localstorage work and not the server stuff in the PHP files. 当我使用Eclipse测试APK文件时,只有具有localstorage的html页面有效,而PHP文件中没有服务器内容。 How can I direct my PHP files to go to a server since all the APK does it package everything on the client side? 由于所有APK都会在客户端打包所有内容,因此如何将我的PHP文件定向到服务器?

Thanks 谢谢

You can't run php files on mobile except on the browser 除浏览器外,您无法在手机上运行php文件

So if you want to run PHP files put them on the server and invoke them to return or accept data from you 因此,如果要运行PHP文件,请将其放在服务器上并调用它们以返回或接受您的数据

To run PHP files you need a web server which doesn't exist on a mobile 要运行PHP文件,您需要一个移动设备上不存在的Web服务器

I believe that you asked this because you could run javascript & HTML files on the mobile 我相信您是问这个问题的,因为您可以在移动设备上运行javascript和HTML文件

I will recommend two things 我会推荐两件事

1- If you need to run PHP make ana AJAX request on it and keep it on the server and remember the cross-domain 1-如果您需要运行PHP,请对其进行ana AJAX请求,并将其保存在服务器上,并记住跨域

2- you need to consider the performance of the app you are making because after personal experience its slow 2-您需要考虑正在制作的应用程序的性能,因为在亲身经历之后,它的运行速度很慢

One More thing it works on the chrome because you have a web server (APACHE) on your machine 它在chrome上可以工作的另一件事是因为您的计算机上有一个Web服务器(APACHE)

You can run PHP on Android. 您可以在Android上运行PHP。 Try SL4A. 尝试SL4A。 Web servers can exist on a mobile. Web服务器可以存在于移动设备上。 There are quite a few that function as a local server, within Android apps. 在Android应用程序中,有很多功能可以用作本地服务器。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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