{"id":2318,"date":"2023-08-08T18:39:23","date_gmt":"2023-08-08T10:39:23","guid":{"rendered":"https:\/\/www.yimenyun.cn\/emen\/?p=2318"},"modified":"2023-08-08T18:39:23","modified_gmt":"2023-08-08T10:39:23","slug":"php%e7%a8%8b%e5%ba%8f%e5%a6%82%e4%bd%95%e7%94%9f%e6%88%90app%ef%bc%9f","status":"publish","type":"post","link":"https:\/\/www.yimenyun.cn\/emen\/2318\/","title":{"rendered":"php\u7a0b\u5e8f\u5982\u4f55\u751f\u6210app\uff1f"},"content":{"rendered":"

\u5728\u8fd9\u7bc7\u6587\u7ae0\u4e2d\uff0c\u6211\u5c06\u5411\u60a8\u4ecb\u7ecd\u5982\u4f55\u5c06PHP\u7a0b\u5e8f\u8f6c\u5316\u4e3a\u79fb\u52a8\u5e94\u7528\uff08APP\uff09\u7684\u65b9\u6cd5\u3002\u8bf7\u6ce8\u610f\uff0c\u539f\u751f\u7684Android\u548ciOS\u5e94\u7528\u901a\u5e38\u4f7f\u7528Java\u3001Kotlin\u548cSwift\u7f16\u5199\uff0c\u800cPHP\u4e3b\u8981\u7528\u4e8e\u670d\u52a1\u5668\u7aef\u7f16\u7a0b\u3002\u5c3d\u7ba1\u5982\u6b64\uff0c\u6211\u4eec\u53ef\u4ee5\u901a\u8fc7\u4f7f\u7528Web\u89c6\u56fe\u548c\u6df7\u5408\u5e94\u7528\u5f00\u53d1\u6846\u67b6\uff0c\u5c06\u60a8\u7684PHP\u7a0b\u5e8f\u8f6c\u5316\u4e3a\u79fb\u52a8\u5e94\u7528\u3002<\/p>\n

\u539f\u7406\uff1a<\/p>\n

\u5c06PHP\u7a0b\u5e8f\u8f6c\u5316\u4e3a\u79fb\u52a8\u5e94\u7528\u7684\u6838\u5fc3\u539f\u7406\u662f\u5c06\u73b0\u6709\u7684PHP\u7f51\u7ad9\u6216\u7f51\u7edc\u5e94\u7528\u5d4c\u5165\u5230\u539f\u751f\u5e94\u7528\u4e2d\u3002\u6211\u4eec\u5c06\u4f7f\u7528\u6df7\u5408\u5e94\u7528\u5f00\u53d1\u6846\u67b6\uff0c\u4f8b\u5982Apache Cordova\uff08\u4ee5\u524d\u79f0\u4e3aPhoneGap\uff09\u6216Ionic\uff0c\u5c06\u7f51\u7ad9\u7684\u5185\u5bb9\u663e\u793a\u5728\u4e00\u4e2a\u540d\u4e3aWeb\u89c6\u56fe\u7684\u539f\u751f\u7ec4\u4ef6\u4e0a\u3002\u8fd9\u6837\u7684\u7ed3\u679c\u5c31\u662f\u4e00\u4e2a\u517c\u5177\u7f51\u7ad9\u548c\u539f\u751f\u5e94\u7528\u7279\u6027\u7684\u5e94\u7528\u7a0b\u5e8f\u3002<\/p>\n

\u6b65\u9aa41\uff1a\u4e3a\u60a8\u7684PHP\u7a0b\u5e8f\u9009\u62e9\u5408\u9002\u7684\u6846\u67b6<\/p>\n

\u60a8\u53ef\u4ee5\u9009\u62e9\u4ee5\u4e0b\u5e38\u7528\u6846\u67b6\u6765\u5b9e\u73b0\uff1a<\/p>\n

1. Apache Cordova\uff08PhoneGap\uff09<\/p>\n

2. Ionic Framework<\/p>\n

\u8fd9\u4e9b\u6846\u67b6\u8bbe\u8ba1\u4e3a\u517c\u5bb9HTML\u3001CSS\u3001JavaScript\u548c\u76f8\u5173Web\u6280\u672f\uff0c\u53ef\u4ee5\u5e2e\u60a8\u51cf\u5c11\u5c06PHP\u7a0b\u5e8f\u8f6c\u6362\u4e3a\u79fb\u52a8\u5e94\u7528\u6240\u9700\u7684\u5de5\u4f5c\u91cf\u3002<\/p>\n

\u6b64\u5904\u4ee5Apache Cordova\u4e3a\u4f8b\uff0c\u6211\u4eec\u5c06\u4e86\u89e3\u5982\u4f55\u5c06PHP\u7a0b\u5e8f\u8f6c\u5316\u4e3a\u79fb\u52a8\u5e94\u7528\u3002<\/p>\n

\u6b65\u9aa42\uff1a\u5b89\u88c5\u5fc5\u8981\u7684\u5de5\u5177\u548c\u73af\u5883<\/p>\n

\u4e3a\u4e86\u4f7f\u7528Apache Cordova\uff0c\u60a8\u9700\u8981\u5b89\u88c5\u4ee5\u4e0b\u5de5\u5177\uff1a<\/p>\n

1. \u5b89\u88c5Node.js\uff1a\u8bf7\u8bbf\u95ee https:\/\/nodejs.org\/ \u4e0b\u8f7d\u5e76\u5b89\u88c5\u9002\u5408\u60a8\u7cfb\u7edf\u7684\u7248\u672c\u3002<\/p>\n

2. \u5b89\u88c5cordova\u547d\u4ee4\u884c\u5de5\u5177\uff1a\u6253\u5f00\u547d\u4ee4\u63d0\u793a\u7b26\u6216\u7ec8\u7aef\uff0c\u8fd0\u884c\u4ee5\u4e0b\u547d\u4ee4\uff1a<\/p>\n

“`<\/p>\n

npm install -g cordova<\/p>\n

`h5\u751f\u6210\u7684app\u5982\u4f55\u63a7\u5236\u624b\u673a\u7684\u540e\u9000\u952e<\/a>“<\/p>\n

\u6b65\u9aa43\uff1a\u521b\u5efaCordova\u9879\u76ee<\/p>\n

\u521b\u5efa\u4e00\u4e2a\u65b0\u7684cordova\u9879\u76ee\uff0c\u6253\u5f00\u547d\u4ee4\u63d0\u793a\u7b26\u6216\u7ec8\u7aef\uff0c\u8fd0\u884c\u4ee5\u4e0b\u547d\u4ee4\uff08\u5c06YourAppName\u66ff\u6362\u4e3a\u60a8\u7684\u5e94\u7528\u540d\u79f0\uff09\uff1a<\/p>\n

“`<\/p>\n

cordova create YourAppName<\/p>\n

“`<\/p>\n

\u6b65\u9aa44\uff1a\u8fdb\u5165\u9879\u76ee\u76ee\u5f55\u5e76\u6dfb\u52a0\u5e73\u53f0<\/p>\n

\u901a\u8fc7\u4ee5\u4e0b\u547d\u4ee4\u8fdb\u5165\u9879\u76ee\u76ee\u5f55\u4ee5\u53ca\u6dfb\u52a0\u5bf9\u5e94\u7684\u5e73\u53f0\u5728\u7ebf\u7f51\u7ad9app\u751f\u6210<\/a>\uff08\u4f8b\u5982Android\u548ciOS\uff09\uff1a<\/p>\n

“`<\/p>\n

cd YourAppName<\/p>\n

cordova platform add android<\/p>\n

cordova platform add ios<\/p>\n

“`<\/p>\n

\u6ce8\u610f\uff0cios\u6784\u5efa\u9700\u8981\u5728macos\u7cfb\u7edf\u4e0a\u8fdb\u884c\u3002<\/p>\n

\u6b65\u9aa45\uff1a\u6574\u5408\u60a8\u7684PHP\u7a0b\u5e8f<\/p>\n

\u5f52\u6863\u60a8\u7684PHP\u7f51\u7ad9\u5185\u5bb9\u5230\u4e00\u4e2a\u538b\u7f29\u6587\u4ef6\uff08\u4f8b\u5982.zip\uff09\uff0c\u786e\u4fdd\u6240\u6709\u7684\u6587\u4ef6\uff08\u5305\u62ec.php\uff09\u90fd\u5728www\u76ee\u5f55\u4e0b\u3002\u5c06\u5176\u89e3\u538b\u5230\u521a\u521a\u521b\u5efa\u7684Cordova\u9879\u76ee\u7684www\u76ee\u5f55\u4e2d\uff1a<\/p>\n

“`<\/p>\n

YourAppName\/www\/<\/p>\n

“`<\/p>\n

\u6b65\u9aa46\uff1a\u4fee\u6539config.xml<\/p>\n

\u6253\u5f00config.xml\u6587\u4ef6\uff0c\u627e\u5230“\uff0c\u5c06\u5176\u4fee\u6539\u4e3a\u60a8\u7684PHP\u7f51\u7ad9\u4e2d\u5165\u53e3\u9875\u9762\u7684\u5730\u5740\u3002<\/p>\n

\u4f8b\u5982\uff1a<\/p>\n

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

“`<\/p>\n

\u6b65\u9aa47\uff1a\u914d\u7f6e\u670d\u52a1\u5668<\/p>\n

\u7531\u4e8ePHP\u4e3a\u670d\u52a1\u5668\u7aef\u8bed\u8a00\uff0c\u60a8\u9700\u8981\u5728Cordova\u5e94\u7528\u7a0b\u5e8f\u5185\u521b\u5efa\u4e00\u4e2aWeb\u670d\u52a1\u5668\u6765\u5904\u7406PHP\u8bf7\u6c42\u3002\u4ee5\u4e0b\u662f\u4e24\u79cd\u5e38\u89c1\u7684\u65b9\u6cd5\uff1a<\/p>\n

– \u5b89\u88c5cordova\u63d2\u4ef6\uff1a\u201ccordova-plugin-httpd\u201d\uff0c\u4e00\u4e2a\u7b80\u5355\u7684HTTP\u670d\u52a1\u5668\u3002\u7136\u540e\u5728\u521b\u5efa\u5bf9\u8c61\u7684\u65f6\u5019\uff0c\u5728\u7aef\u53e3\u53f7\u4e0a\u8bbe\u7f6e\u4e00\u4e2a\u6709\u6548\u7684\u76d1\u542c\u76d1\u542c\uff0c\u5c06\u670d\u52a1\u5668\u7684\u6839\u76ee\u5f55\u653e\u8fdbwww\u76ee\u5f55\u5373\u53ef\u3002<\/p>\n

– \u4f7f\u7528Ionic\u6846\u67b6\uff0c\u901a\u8fc7Ionic server\u529f\u80fd\u5b9e\u73b0\u3002<\/p>\n

\u6b65\u9aa48\uff1a\u6784\u5efa\u548c\u8fd0\u884cAPP<\/p>\n

\u73b0\u5728\uff0c\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u4e3a\u7279\u5b9a\u7684\u5e73\u53f0\u6784\u5efa\u548c\u8fd0\u884c\u60a8\u7684\u5e94\u7528\u7a0b\u5e8f\uff1a<\/p>\n

“`<\/p>\n

cordova build android<\/p>\n

cordova run android<\/p>\n

“`<\/p>\n

\u66ff\u6362’android’\u4e3a’iOS’\uff0c\u5982\u679c\u60a8\u521b\u5efa\u4e86\u4e00\u4e2aiOS\u5e94\u7528\u7a0b\u5e8f\u3002<\/p>\n

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

\u81f3\u6b64\uff0c\u60a8\u5df2\u7ecf\u5c06PHP\u7a0b\u5e8f\u8f6c\u5316\u4e3a\u4e00\u4e2a\u79fb\u52a8\u5e94\u7528\u3002\u4e0d\u8fc7\uff0c\u8bf7\u6ce8\u610f\uff0c\u8fd9\u79cd\u65b9\u6848\u7684\u6027\u80fd\u53ef\u80fd\u4e0d\u5982\u539f\u751f\u5f00\u53d1\u7684\u5e94\u7528\u3002\u5982\u60a8\u9700\u8981\u5b9e\u73b0\u66f4\u9ad8\u6027\u80fd\u7684\u539f\u751f\u5e94\u7528\uff0c\u53ef\u4ee5\u8003\u8651\u5728\u524d\u7aef\u4f7f\u7528\u5176\u4ed6\u6280\u672f\u5982React Native\uff0cVue Native\u7b49\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"

\u5728\u8fd9\u7bc7\u6587\u7ae0\u4e2d\uff0c\u6211\u5c06\u5411\u60a8\u4ecb\u7ecd\u5982\u4f55\u5c06PHP\u7a0b\u5e8f\u8f6c\u5316\u4e3a\u79fb\u52a8\u5e94\u7528\uff08APP\uff09\u7684\u65b9\u6cd5\u3002\u8bf7\u6ce8\u610f\uff0c\u539f\u751f\u7684Android\u548ciOS\u5e94\u7528\u901a\u5e38\u4f7f\u7528Java\u3001Kotlin\u548cSwift\u7f16\u5199\uff0c\u800cPHP\u4e3b\u8981\u7528\u4e8e\u670d\u52a1\u5668\u7aef\u7f16\u7a0b\u3002\u5c3d\u7ba1\u5982<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[797,89,4870,4869,2122],"topic":[],"class_list":{"0":"post-2318","1":"post","2":"type-post","3":"status-publish","4":"format-standard","5":"hentry","6":"category-appkf","7":"tag-797","8":"tag-89","9":"tag-app","11":"tag-2122"},"_links":{"self":[{"href":"https:\/\/www.yimenyun.cn\/emen\/wp-json\/wp\/v2\/posts\/2318","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\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.yimenyun.cn\/emen\/wp-json\/wp\/v2\/comments?post=2318"}],"version-history":[{"count":0,"href":"https:\/\/www.yimenyun.cn\/emen\/wp-json\/wp\/v2\/posts\/2318\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.yimenyun.cn\/emen\/wp-json\/wp\/v2\/media?parent=2318"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.yimenyun.cn\/emen\/wp-json\/wp\/v2\/categories?post=2318"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.yimenyun.cn\/emen\/wp-json\/wp\/v2\/tags?post=2318"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.yimenyun.cn\/emen\/wp-json\/wp\/v2\/topic?post=2318"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}