从本地“资源”加载图像或整个站点使用 webview 的文件夹

发布于 2024-09-14 08:09:12 字数 233 浏览 1 评论 0原文

我的问题很简单,但很难用语言表达,无论如何我都会尝试一下。

我正在尝试在 webview 中加载网页。然而,加载时间有点太长了。

  • 有什么方法可以将图像放入资产文件夹中并从那里加载它们吗?
  • 如果没有,有没有办法可以从资产文件夹加载整个网站,前提是我的 PHP 文件仍然可以与我的互联网数据库通信?

我已经阅读了大多数教程,但当涉及到具体帮助时,这些教程相当模糊。

The question I have is simple but hard to put in words, I'll give it a try anyways.

I am trying to load a web page in webview. However, the load time is a little bit too high.

  • Is there any way I can put the images in the assets folder and load them from there instead?
  • If not, is there a way I can load the whole site from the assets folder, providing that my PHP files can still communicate with my internet database?

I have already read most tutorials, but those are pretty vague when it comes to concrete help.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

梦毁影碎の 2024-09-21 08:09:12

无法将您的 php 文件存储在设备本身上。他们需要一个服务器来执行它们并将结果发送到设备,如果它们在设备上,您只需将 php 代码显示到您的 webview,那肯定是行不通的。

Webview 应该能够缓存一些图像本身。但似乎无法从 web 视图访问 SD 卡或内部存储中的图像。

也许可以通过 html5 本地存储 api 存储一些数据,但我对此没有任何专业知识。

There is no way to store your php files on the device itself. They need a server to execute them and sent the result to the device if the are on the device you would just show the php code to your webview and that would certainly not work.

The Webview should be able to cache some of the images itself. But it seems that there is no way to access images from the sd card or the internal storage from your webview.

Maybe it is possible to store some of your data through html5 local storage apis but I don't have any expertise on that.

囚你心 2024-09-21 08:09:12

当然 !你可以做到的。只需安装 AndroPhp,它是 Android 的本地服务器。

在设备上的 www/ 文件夹下找到您的项目。如果您有数据库,也只需通过 phpmyadmin 导入 .sql。

在 Android 端调用您的项目 127.0.0.1:8080/yourProject

就这样!

Sure ! you can do it. Just install AndroPhp it is a localServer for Android.

Locate you project than on your device under the www/ folder. If you have a DB also just import your .sql trough phpmyadmin.

on Android side call you project 127.0.0.1:8080/yourProject

Thats All!

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文