问题
I am new to the PWA. So I was trying to create a basic website. which include index.html, manifest, serviceworker file, answer.php. Answer.php is running on server. on clicking a button in index.html, it goes to answer.php where data is obtained from the database. I am caching all the files except serviceworker and answer.php.
Q1: Should I cache answer.php?
Q2: If not, then how can I connect it to indexed db (represent data obtained from server in the form of html file).
Q3: what is the role of server files in PWA.
回答1:
Q1: Should i cache answer.php?
I don't think so, since its generating data querying the database.
Q2: If not, then how can i connect it to indexed db (represent data obtained from server in the form of html file).
You can use answer.php to return a JSON to your PWA: Manual JSON Encode
Q3: what is the role of server files in PWA
Any backend services. I.E.: How to build a JSON backend with PHP
来源:https://stackoverflow.com/questions/58016408/role-of-php-file-in-pwa