{"id":17401,"date":"2024-03-04T17:24:58","date_gmt":"2024-03-04T09:24:58","guid":{"rendered":"https:\/\/www.yimenyun.cn\/emen\/?p=17401"},"modified":"2024-03-04T17:24:58","modified_gmt":"2024-03-04T09:24:58","slug":"php-%e7%94%9f%e6%88%90-app%e6%9c%89%e5%93%aa%e4%ba%9b%e5%8a%9e%e6%b3%95%e5%91%a2%ef%bc%9f","status":"publish","type":"post","link":"https:\/\/www.yimenyun.cn\/emen\/17401\/","title":{"rendered":"php \u751f\u6210 app\u6709\u54ea\u4e9b\u529e\u6cd5\u5462\uff1f"},"content":{"rendered":"

PHP\u662f\u4e00\u79cd\u5e7f\u6cdb\u4f7f\u7528\u7684\u5f00\u6e90\u670d\u52a1\u5668\u811a\u672c\u8bed\u8a00\uff0c\u5b83\u53ef\u4ee5\u7528\u4e8eWeb\u5f00\u53d1\uff0c\u547d\u4ee4\u884c\u811a\u672c\u7f16\u5199\u4ee5\u53ca\u5176\u4ed6\u9886\u57df\u3002\u5728\u79fb\u52a8\u5e94\u7528\u5f00\u53d1\u4e2d\uff0cPHP\u53ef\u4ee5\u7528\u4e8e\u751f\u6210APP\u3002<\/p>\n

\u751f\u6210APP\u7684\u539f\u7406<\/p>\n

APP\u751f\u6210\u7684\u539f\u7406\u662f\u901a\u8fc7\u5c06\u7f51\u7ad9\u5c01\u88c5\u6210\u4e00\u4e2aAPP\uff0c\u7136\u540e\u901a\u8fc7APP\u7684\u65b9\u5f0f\u6765\u5c55\u793a\u7f51\u7ad9\u5185\u5bb9\u3002\u5728\u8fd9\u4e2a\u8fc7\u7a0b\u4e2d\uff0cPHP\u53ef\u4ee5\u901a\u8fc7\u4ee5\u4e0b\u65b9\u5f0f\u6765\u751f\u6210APP\uff1a<\/p>\n

1. \u4f7f\u7528Web App Manifest<\/p>\n

Web App Manifest\u662f\u4e00\u4e2aJSON\u6587\u4ef6\uff0c\u5b83\u53ef\u4ee5\u6307\u5b9a\u7f51\u7ad9\u7684\u56fe\u6807\u3001\u540d\u79f0\u3001\u4e3b\u9898\u8272\u3001\u542f\u52a8\u65b9\u5f0f\u7b49\u4fe1\u606f\u3002\u901a\u8fc7\u4f7f\u7528Web App Manifest\u53ef\u4ee5\u5c06\u7f51\u7ad9\u8f6c\u6362\u6210\u4e00\u4e2aPWA\uff08Progressive Web App\uff09\uff0c\u7136\u540e\u901a\u8fc7PWA\u751f\u6210APP\u3002<\/p>\n

2. \u4f7f\u7528\u7b2c\u4e09\u65b9\u5de5\u5177<\/p>\n

\u6709\u5f88\u591a\u7b2c\u4e09\u65b9\u5de5\u5177\u53ef\u4ee5\u5c06\u7f51\u7ad9\u8f6c\u6362\u6210APP\uff0c\u6bd4\u5982PhoneGap\u3001Cordova\u3001Ionic\u7b49\u3002\u8fd9\u4e9b\u5de5\u5177\u53ef\u4ee5\u5c06\u7f51\u7ad9\u6253\u5305\u6210\u4e00\u4e2aAPP\uff0c\u7136\u540e\u901a\u8fc7\u5e94\u7528\u5546\u5e97\u6216\u8005\u5176\u4ed6\u65b9\u5f0f\u8fdb\u884c\u53d1\u5e03\u3002<\/p>\n

3. \u81ea\u5df1\u5f00\u53d1APP<\/p>\n

\u5982\u679c\u9700\u8981\u66f4\u52a0\u5b9a\u5236\u5316\u7684APP\uff0c\u53ef\u4ee5\u4f7f\u7528PHP\u6765\u8fdb\u884c\u5f00\u53d1\u3002PHP\u53ef\u4ee5\u901a\u8fc7\u8c03\u7528\u7cfb\u7edfAPI\u3001\u4f7f\u7528\u7b2c\u4e09\u65b9SDK\u7b49\u65b9\u5f0f\u6765\u5b9e\u73b0APP\u529f\u80fd\u3002<\/p>\n

\u751f\u6210APP\u7684\u8be6\u7ec6\u4ecb\u7ecd<\/p>\n

1. \u4f7f\u7528Web App Manifest\u751f\u6210APP<\/p>\n

Web App Manifest\u662f\u4e00\u4e2aJSON\u6587\u4ef6\uff0c\u5b83\u5305\u542b\u4e86\u7f51\u7ad9\u7684\u57fa\u672c\u4fe1\u606f\uff0c\u6bd4\u5982\u540d\u79f0\u3001\u56fe\u6807\u3001\u4e3b\u9898\u8272\u3001\u542f\u52a8\u65b9\u5f0f\u7b49\u3002\u901a\u8fc7\u4f7f\u7528Web App Manifest\u53ef\u4ee5\u5c06\u7f51\u7ad9\u8f6c\u6362\u6210\u4e00\u4e2aPWA\uff0c\u7136\u540e\u901a\u8fc7PWA\u751f\u6210APP\u3002<\/p>\n

\u5177\u4f53\u6b65\u9aa4\u5982\u4e0b\uff1a<\/p>\n

\uff081\uff09\u521b\u5efaWeb App Manifest\u6587\u4ef6<\/p>\n

\u5728\u7f51\u7ad9\u6839\u76ee\u5f55\u4e0b\u521b\u5efa\u4e00\u4e2a\u540d\u4e3amanifest.json\u7684\u6587\u4ef6\uff0c\u7136\u540e\u5728\u6587\u4ef6\u4e2d\u6dfb\u52a0\u4ee5\u4e0b\u4ee3\u7801\uff1a<\/p>\n

“`<\/p>\n

{<\/p>\n

“name”: “My App”,<\/p>\n

“short_name”: “My App”,<\/p>\n

“start_url”: “\/”,<\/p>\n

“display”: “standalone”,<\/p>\n

“background_color”: “#ffffff”,<\/p>\n

“theme_color”: “#000000”,<\/p>\n

“icons”: [<\/p>\n

{<\/p>\n

“src”: “\/images\/icons\/icon-72×72.png”,<\/p>\n

“sizes”: “72×72”,<\/p>\n

“type”: “image\/png”<\/p>\n

},<\/p>\n

{<\/p>\n

“src”: “\/images\/icons\/icon-96×96.png”,<\/p>\n

“sizes”: “96×96”,<\/p>\n

“type”: <\/p>\n

<\/figure>\n<\/p>\n

“image\/png”<\/p>\n

},<\/p>\n

{<\/p>\n

“src”: “\/images\/icons\/icon-128×128.png”,<\/p>\n

“sizes”: “128×128”,<\/p>\n

“type”: “image\/png”<\/p>\n

},<\/p>\n

{<\/p>\n

“src”: “\/images\/icons\/icon-144×144.png”,<\/p>\n

“sizes”: “144×144”,<\/p>\n

“type”: “image\/png”<\/p>\n

},<\/p>\n

{<\/p>\n

“src”: “\/images\/icons\/icon-152×152.png”,<\/p>\n

“sizes”: “152×152”,<\/p>\n

“type”: “image\/png”<\/p>\n

},<\/p>\n

{<\/p>\n

“src”: “\/images\/icons\/icon-192×192.png”,<\/p>\n

“sizes”: “192×192”,<\/p>\n

“type”: “image\/png”<\/p>\n

},<\/p>\n

{<\/p>\n

“src”: “\/images\/icons\/icon-384×384.png”,<\/p>\n

“sizes”: “384×384”,<\/p>\n

“type”: “image\/png”<\/p>\n

},<\/p>\n

{<\/p>\n

“src”: “\/images\/icons\/icon-512×512.png”,<\/p>\n

“sizes”: “512×512”,<\/p>\n

“type”: “image\/png”<\/p>\n

}<\/p>\n

]<\/p>\n

}<\/p>\n

“`<\/p>\n

\u5728\u8fd9\u4e2a\u6587\u4ef6\u4e2d\uff0cname\u548cshort_name\u8868\u793aAPP\u7684\u540d\u79f0\uff0cstart_url\u8868\u793aAPP\u542f\u52a8\u65f6\u6253\u5f00\u7684\u9875\u9762\uff0cdisplay\u8868\u793aAPP\u7684\u542f\u52a8\u65b9\u5f0f\uff0cbackground_color\u548ctheme_color\u8868\u793aAPP\u7684\u4e3b\u9898\u8272\uff0cicons\u8868\u793aAPP\u7684\u56fe\u6807\u3002<\/p>\n

\uff082\uff09\u6dfb\u52a0PWA\u652f\u6301<\/p>\n

\u5728\u7f51\u7ad9\u7684HTML\u6587\u4ef6\u4e2d\u6dfb\u52a0\u4ee5\u4e0b\u4ee3\u7801\uff1a<\/p>\n

“`<\/p>\n<\/p>\n<\/p>\n<\/p>\n

“`<\/p>\n

\u5176\u4e2d\uff0clink rel=”manifest” href=”\/manifest.json”\u8868\u793a\u5f15\u7528Web App Manifest\u6587\u4ef6\uff0cmeta name=”theme-color” content=”#000000″\u8868\u793a\u8bbe\u7f6ediscuz \u5b89\u5353 app<\/a>APP\u7684\u4e3b\u9898\u8272\uff0cmeta name=”apple-mobile-web-app-capable” content=”yes”\u8868\u793a\u652f\u6301PWA\uff0cmeta name=”apple-mobile-web-app-status-bar-style” content=”black-translucent”\u8868\u793a\u8bbe\u7f6e\u72b6\u6001\u680f\u6837\u5f0f\uff0clink rel=”apple-touch-icon” href=”\/images\/icons\/icon-512×512.png”\u8868\u793a\u8bbe\u7f6eAPP\u7684\u56fe\u6807\u3002<\/p>\n

\uff083\uff09\u751f\u6210PWA<\/p>\n

\u901a\u8fc7\u4ee5\u4e0a\u6b65\u9aa4\uff0c\u7f51\u7ad9\u5df2\u7ecf\u652f\u6301PWA\u4e86\u3002\u5728Chrome\u6d4f\u89c8\u5668\u4e2d\u8bbf\u95ee\u7f51\u7ad9\uff0c\u7136\u540e\u5728\u5730\u5740\u680f\u4e2d\u70b9\u51fb\u201c\u6dfb\u52a0\u5230\u4e3b\u5c4f\u5e55\u201d\uff0c\u5c31\u53ef\u4ee5\u5c06\u7f51\u7ad9\u6dfb\u52a0\u5230\u4e3b\u5c4f\u5e55\u4e0a\u4e86\u3002<\/p>\n

\uff084\uff09\u901a\u8fc7PWA\u751f\u6210APP<\/p>\n

\u5728\u624b\u673a\u4e0a\u6253\u5f00\u521a\u624d\u6dfb\u52a0\u5230\u4e3b\u5c4f\u5e55\u4e0a\u7684\u7f51\u7ad9\uff0c\u7136\u540e\u9009\u62e9\u201c\u6dfb\u52a0\u5230\u4e3b\u5c4f\u5e55\u201d\uff0c\u5c31\u53ef\u4ee5\u5c06\u7f51\u7ad9\u751f\u6210\u4e00\u4e2aAPP\u4e86\u3002<\/p>\n

2. \u4f7f\u7528\u7b2c\u4e09\u65b9\u5de5\u5177\u751f\u6210APP<\/p>\n

\u4f7f\u7528\u7b2c\u4e09\u65b9\u5de5\u5177\u751f\u6210APP\u6bd4\u8f83\u7b80\u5355\uff0c\u53ea\u9700\u8981\u6309\u7167\u4ee5\u4e0b\u6b65\u9aa4\u64cd\u4f5c\u5373\u53ef\uff1a<\/p>\n

\uff081\uff09\u9009\u62e9\u4e00\u4e2a\u7b2c\u4e09\u65b9\u5de5\u5177\uff0c\u6bd4\u5982PhoneGap\u3001Cordova\u3001Ionic\u7b49\u3002<\/p>\n

\uff082\uff09\u5728\u5de5\u5177\u7684\u5b98\u7f51\u4e0a\u4e0b\u8f7d\u5b89\u88c5\u5305\uff0c\u7136\u540e\u5b89\u88c5\u3002<\/p>\n

\uff083\uff09\u6253\u5f00\u5de5\u5177\uff0c\u9009\u62e9\u201c\u65b0\u5efa\u9879\u76ee\u201d\uff0c\u7136\u540e\u6309\u7167\u63d0\u793a\u586b\u5199\u9879\u76ee\u4fe1\u606f\u3002<\/p>\n

\uff084\uff09\u5c06\u7f51\u7ad9\u7684\u4ee3\u7801\u590d\u5236\u5230\u5de5\u5177\u4e2d\uff0c\u6309\u7167\u5de5\u5177\u7684\u8981\u6c42\u8fdb\u884c\u914d\u7f6e\u548c\u6253\u5305\u3002<\/p>\n

\uff085\uff09\u751f\u6210APP\uff0c\u7136\u540e\u901a\u8fc7\u5e94\u7528\u5546\u5e97\u6216\u8005\u5176\u4ed6\u65b9\u5f0f\u8fdb\u884c\u53d1\u5e03\u3002<\/p>\n

3. \u81ea\u5df1\u5f00\u53d1APP<\/p>\n

\u5982\u679c\u9700\u8981\u66f4\u52a0\u5b9a\u5236\u5316\u7684APP\uff0c\u53ef\u4ee5\u4f7f\u7528PHP\u6765\u8fdb\u884c\u5f00\u53d1\u3002\u5177\u4f53\u6b65\u9aa4\u5982\u4e0b\uff1a<\/p>\n

\uff081\uff09\u786e\u5b9aAPP\u7684\u529f\u80fd\u548c\u754c\u9762\u8bbe\u8ba1\u3002<\/p>\n

\uff082\uff09\u4f7f\u7528PHP\u5f00\u53d1APP\u7684\u540e\u7aef\u903b\u8f91\uff0c\u6bd4\u5982\u5904\u7406\u7528\u6237\u767b\u5f55\u3001\u6ce8\u518c\u3001\u6570\u636e\u67e5\u8be2\u7b49\u64cd\u4f5c\u3002<\/p>\n

\uff083\uff09\u4f7f\u7528HTML\u3001CSS\u548cJavaScript\u5f00\u53d1APP\u7684\u524d\u7aef\u754c\u9762\u3002<\/p>\n

\uff084\uff09\u5c06\u540e\u7aef\u903b\u8f91\u548c\u524d\u7aefandroid wear app<\/a>\u754c\u9762\u6574\u5408\u8d77\u6765\uff0c\u5f62\u6210\u4e00\u4e2a\u5b8c\u6574\u7684APP\u3002<\/p>\n

\uff085\uff09\u4f7f\u7528\u7b2c\u4e09\u65b9\u5de5\u5177\u6216\u8005\u81ea\u5df1\u5f00\u53d1\u7684\u5de5\u5177\u5c06APP\u6253\u5305\u6210APK\u6216\u8005IPA\u683c\u5f0f\uff0c\u7136\u540e\u901a\u8fc7\u5e94\u7528\u5546\u5e97\u6216\u8005\u5176\u4ed6\u65b9\u5f0f\u8fdb\u884c\u53d1\u5e03\u3002<\/p>\n

\u603b\u7ed3<\/p>\n

\u901a\u8fc7\u4ee5\u4e0a\u4e09\u79cd\u65b9\u5f0f\uff0c\u53ef\u4ee5\u4f7f\u7528PHP\u6765\u751f\u6210APP\u3002\u5176\u4e2d\uff0c\u4f7f\u7528Web App Manifest\u751f\u6210APP\u6bd4\u8f83\u7b80\u5355\uff0c\u4f46\u662f\u529f\u80fd\u548c\u754c\u9762\u6bd4\u8f83\u6709\u9650\uff1b\u4f7f\u7528\u7b2c\u4e09\u65b9\u5de5\u5177\u751f\u6210APP\u6bd4\u8f83\u65b9\u4fbf\uff0c\u4f46\u662f\u53ef\u5b9a\u5236\u6027\u4e0d\u592a\u9ad8\uff1b\u81ea\u5df1\u5f00\u53d1APP\u9700\u8981\u6295\u5165\u66f4\u591a\u7684\u65f6\u95f4\u548c\u7cbe\u529b\uff0c\u4f46\u662f\u53ef\u4ee5\u5b9e\u73b0\u66f4\u52a0\u5b9a\u5236\u5316\u7684\u529f\u80fd\u548c\u754c\u9762\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"

PHP\u662f\u4e00\u79cd\u5e7f\u6cdb\u4f7f\u7528\u7684\u5f00\u6e90\u670d\u52a1\u5668\u811a\u672c\u8bed\u8a00\uff0c\u5b83\u53ef\u4ee5\u7528\u4e8eWeb\u5f00\u53d1\uff0c\u547d\u4ee4\u884c\u811a\u672c\u7f16\u5199\u4ee5\u53ca\u5176\u4ed6\u9886\u57df\u3002\u5728\u79fb\u52a8\u5e94\u7528\u5f00\u53d1\u4e2d\uff0cPHP\u53ef\u4ee5\u7528\u4e8e\u751f\u6210APP\u3002\u751f\u6210APP\u7684\u539f\u7406APP\u751f\u6210\u7684\u539f\u7406\u662f\u901a\u8fc7\u5c06\u7f51\u7ad9\u5c01\u88c5\u6210\u4e00\u4e2aAPP\uff0c<\/p>\n","protected":false},"author":23,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[20349,20348,52,865,247],"topic":[],"class_list":["post-17401","post","type-post","status-publish","format-standard","hentry","category-appkf","tag-app--h5","tag-htmlapp","tag-52","tag-865","tag-247"],"_links":{"self":[{"href":"https:\/\/www.yimenyun.cn\/emen\/wp-json\/wp\/v2\/posts\/17401","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.yimenyun.cn\/emen\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.yimenyun.cn\/emen\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.yimenyun.cn\/emen\/wp-json\/wp\/v2\/users\/23"}],"replies":[{"embeddable":true,"href":"https:\/\/www.yimenyun.cn\/emen\/wp-json\/wp\/v2\/comments?post=17401"}],"version-history":[{"count":1,"href":"https:\/\/www.yimenyun.cn\/emen\/wp-json\/wp\/v2\/posts\/17401\/revisions"}],"predecessor-version":[{"id":17423,"href":"https:\/\/www.yimenyun.cn\/emen\/wp-json\/wp\/v2\/posts\/17401\/revisions\/17423"}],"wp:attachment":[{"href":"https:\/\/www.yimenyun.cn\/emen\/wp-json\/wp\/v2\/media?parent=17401"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.yimenyun.cn\/emen\/wp-json\/wp\/v2\/categories?post=17401"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.yimenyun.cn\/emen\/wp-json\/wp\/v2\/tags?post=17401"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.yimenyun.cn\/emen\/wp-json\/wp\/v2\/topic?post=17401"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}