{"id":136138,"date":"2019-02-22T09:52:22","date_gmt":"2019-02-22T01:52:22","guid":{"rendered":"https:\/\/lrxjmw.cn\/?p=136138"},"modified":"2019-02-18T09:55:39","modified_gmt":"2019-02-18T01:55:39","slug":"php-introduce","status":"publish","type":"post","link":"https:\/\/lrxjmw.cn\/php-introduce.html","title":{"rendered":"\u7b80\u5355\u63cf\u8ff0PHP\u53d1\u5c55\u5386\u7a0b"},"content":{"rendered":"
PHP\uff08\u5916\u6587\u540d:PHP: Hypertext Preprocessor\uff0c\u4e2d\u6587\u540d\uff1a\u201c\u8d85\u6587\u672c\u9884\u5904\u7406\u5668\u201d\uff09\u662f\u4e00\u79cd\u901a\u7528\u5f00\u6e90\u811a\u672c\u8bed\u8a00\u3002\u8bed\u6cd5\u5438\u6536\u4e86C\u8bed\u8a00\u3001Java\u548cPerl\u7684\u7279\u70b9\uff0c\u5229\u4e8e\u5b66\u4e60\uff0c\u4f7f\u7528\u5e7f\u6cdb\uff0c\u4e3b\u8981\u9002\u7528\u4e8eWeb\u5f00\u53d1\u9886\u57df\u3002PHP \u72ec\u7279\u7684\u8bed\u6cd5\u6df7\u5408\u4e86C\u3001Java\u3001Perl\u4ee5\u53caPHP\u81ea\u521b\u7684\u8bed\u6cd5\u3002\u5b83\u53ef\u4ee5\u6bd4CGI\u6216\u8005Perl\u66f4\u5feb\u901f\u5730\u6267\u884c\u52a8\u6001\u7f51\u9875\u3002\u7528PHP\u505a\u51fa\u7684\u52a8\u6001\u9875\u9762\u4e0e\u5176\u4ed6\u7684\u7f16\u7a0b\u8bed\u8a00\u76f8\u6bd4\uff0cPHP\u662f\u5c06\u7a0b\u5e8f\u5d4c\u5165\u5230HTML\uff08\u6807\u51c6\u901a\u7528\u6807\u8bb0\u8bed\u8a00\u4e0b\u7684\u4e00\u4e2a\u5e94\u7528\uff09\u6587\u6863\u4e2d\u53bb\u6267\u884c\uff0c\u6267\u884c\u6548\u7387\u6bd4\u5b8c\u5168\u751f\u6210HTML\u6807\u8bb0\u7684CGI\u8981\u9ad8\u8bb8\u591a\uff1bPHP\u8fd8\u53ef\u4ee5\u6267\u884c\u7f16\u8bd1\u540e\u4ee3\u7801\uff0c\u7f16\u8bd1\u53ef\u4ee5\u8fbe\u5230\u52a0\u5bc6\u548c\u4f18\u5316\u4ee3\u7801\u8fd0\u884c\uff0c\u4f7f\u4ee3\u7801\u8fd0\u884c\u66f4\u5feb\u3002<\/p>\n
PHP\u662f\u901a\u7528\u670d\u52a1\u5668\u7aef\u811a\u672c\u7f16\u7a0b\u8bed\u8a00\uff0c\u5176\u4e3b\u8981\u7528\u4e8eweb\u5f00\u53d1\u4ee5\u5b9e\u73b0\u52a8\u6001web\u9875\u9762\uff0c\u5b83\u4e5f\u662f\u6700\u65e9\u5b9e\u73b0\u5c06\u811a\u672c\u5d4c\u5165HTML\u6e90\u7801\u6587\u6863\u4e2d\u7684\u670d\u52a1\u5668\u7aef\u811a\u672c\u8bed\u8a00\u4e4b\u4e00\u3002\u540c\u65f6\uff0cphp\u8fd8\u63d0\u4f9b\u4e86\u4e00\u4e2a\u547d\u4ee4\u884c\u63a5\u53e3\uff0c\u56e0\u6b64\uff0c\u5176\u4e5f\u53ef\u4ee5\u5728\u5927\u591a\u6570\u7cfb\u7edf\u4e0a\u4f5c\u4e3a\u4e00\u4e2a\u72ec\u7acb\u7684shell\u6765\u4f7f\u7528\u3002Rasmus Lerdorf\u4e8e1994\u5e74\u5f00\u59cb\u5f00\u53d1PHP\uff0c\u5b83\u662f\u521d\u662f\u4e00\u7ec4\u88abRasmus Lerdorf\u79f0\u4f5c\u201cPersonal Home Page Tool\u201d\u7684Perl\u811a\u672c\uff0c\u8fd9\u4e9b\u811a\u672c\u53ef\u4ee5\u7528\u4e8e\u663e\u793a\u4f5c\u8005\u7684\u7b80\u5386\u5e76\u8bb0\u5f55\u7528\u6237\u5bf9\u5176\u7f51\u7ad9\u7684\u8bbf\u95ee\u3002\u540e\u6765\uff0cRasmus Lerdorf\u4f7f\u7528C\u8bed\u8a00\u5c06\u8fd9\u4e9bPerl\u811a\u672c\u91cd\u5199\u4e3aCGI\u7a0b\u5e8f\uff0c\u8fd8\u4e3a\u5176\u589e\u52a0\u4e86\u8fd0\u884cWeb forms\u7684\u80fd\u529b\u4ee5\u53ca\u4e0e\u6570\u636e\u5e93\u4ea4\u4e92\u7684\u7279\u6027\uff0c\u5e76\u5c06\u5176\u91cd\u547d\u540d\u4e3a\u201cPersonal Home Page\/Forms Interpreter\u201d\u6216\u201cPHP\/FI\u201d\u3002\u6b64\u65f6\uff0cPHP\/FI\u5df2\u7ecf\u53ef\u4ee5\u7528\u4e8e\u5f00\u53d1\u7b80\u5355\u7684\u52a8\u6001web\u7a0b\u5e8f\u4e86\uff0c\u8fd9\u5373\u662fPHP 1.0\u30021995\u5e746\u6708\uff0cRasmus Lerdorf\u628a\u5b83\u7684PHP\u53d1\u5e03\u4e8ecomp.infosystems.www.authoring.cgi Usenet\u8ba8\u8bba\u7ec4\uff0c\u4ece\u6b64PHP\u5f00\u59cb\u8d70\u8fdb\u4eba\u4eec\u7684\u89c6\u91ce\u30021997\u5e74\uff0c\u51762.0\u7248\u672c\u53d1\u5e03\u3002<\/p>\n
1997\u5e74\uff0c\u4e24\u540d\u4ee5\u8272\u5217\u7a0b\u5e8f\u5458Zeev Suraski\u548cAndi Gutmans\u91cd\u5199\u7684PHP\u7684\u5206\u6790\u5668(parser)\u6210\u4e3aPHP\u53d1\u5c55\u52303.0\u7684\u57fa\u7840\uff0c\u800c\u4e14\u4ece\u6b64\u5c06PHP\u91cd\u547d\u540d\u4e3aPHP: Hypertext Preprocessor\u3002\u6b64\u540e\uff0c\u8fd9\u4e24\u540d\u7a0b\u5e8f\u5458\u5f00\u59cb\u91cd\u5199\u6574\u4e2aPHP\u6838\u5fc3\uff0c\u5e76\u72ec\u7acb\u51fa\u6765\u4e8e1999\u5e74\u53d1\u5e03\u4e86Zend Engine 1.0\uff0c\u8fd9\u4e5f\u610f\u5473\u7740PHP 4.0\u7684\u8bde\u751f\u30022004\u5e747\u6708\uff0cZend Engine 2.0\u53d1\u5e03\uff0c\u7531\u6b64\u4e5f\u5c06PHP\u5e26\u5165\u4e86PHP5\u65f6\u4ee3\u3002PHP5\u5305\u542b\u4e86\u8bb8\u591a\u91cd\u8981\u7684\u65b0\u7279\u6027\uff0c\u5982\u589e\u5f3a\u7684\u9762\u5411\u5bf9\u8c61\u7f16\u7a0b\u7684\u652f\u6301\u3001\u652f\u6301PDO(PHP Data Objects)\u6269\u5c55\u673a\u5236\u4ee5\u53ca\u4e00\u7cfb\u5217\u5bf9PHP\u6027\u80fd\u7684\u6539\u8fdb\u3002<\/p>\n
Zend Engine\u662f\u5f00\u6e90\u7684\u3001PHP\u811a\u672c\u8bed\u8a00\u7684\u89e3\u91ca\u5668\uff0c\u5b83\u6700\u65e9\u662f\u7531\u4ee5\u8272\u5217\u7406\u5de5\u5b66\u9662(Technion)\u7684\u5b66\u751fAndi Gutmans\u548cZeev Suraski\u6240\u5f00\u53d1\uff0cZend\u4e5f\u6b63\u662f\u6b64\u4e8c\u4eba\u540d\u5b57\u7684\u5408\u79f0\u3002\u540e\u6765\u4e24\u4eba\u8054\u5408\u521b\u7acb\u4e86Zend Technologies\u516c\u53f8\u3002<\/p>\n
Zend Engine 1.0\u4e8e1999\u5e74\u968fPHP 4\u53d1\u5e03\uff0c\u7531C\u8bed\u8a00\u5f00\u53d1\u4e14\u7ecf\u8fc7\u9ad8\u5ea6\u4f18\u5316\uff0c\u5e76\u80fd\u591f\u505a\u4e3aPHP\u7684\u540e\u7aef\u6a21\u5757\u4f7f\u7528\u3002Zend Engine\u4e3aPHP\u63d0\u4f9b\u4e86\u5185\u5b58\u548c\u8d44\u6e90\u7ba1\u7406\u7684\u529f\u80fd\u4ee5\u53ca\u5176\u5b83\u7684\u4e00\u4e9b\u6807\u51c6\u670d\u52a1\uff0c\u5176\u9ad8\u6027\u80fd\u3001\u53ef\u9760\u6027\u548c\u53ef\u6269\u5c55\u6027\u5728\u4fc3\u8fdbPHP\u6210\u4e3a\u4e00\u79cd\u6d41\u884c\u7684\u8bed\u8a00\u65b9\u9762\u53d1\u6325\u4e86\u91cd\u8981\u4f5c\u7528\u3002<\/p>\n
Zend Engine\u7684\u51fa\u73b0\u5c06PHP\u4ee3\u7801\u7684\u5904\u7406\u8fc7\u7a0b\u5206\u6210\u4e86\u4e24\u4e2a\u9636\u6bb5\uff1a<\/p>\n
PHP\u521a\u5f00\u59cb\u7528\u6237\u8bbf\u95ee\u90fd\u662f\u76f4\u63a5\u7531\u89e3\u91ca\u5668\u89e3\u91ca\uff0c\u52a0\u5165zend\u4e4b\u540e\u5c31\u6210\u4e86\u7528\u6237\u8bbf\u95ee\u65f6\u8981\u5148\u7f16\u8bd1\u5728\u6267\u884c\u4e8c\u8fdb\u5236\u683c\u5f0f\u7ed3\u679c\u662f\u7b2c\u4e00\u6b21\u8bbf\u95ee\u8981\u7f16\u8bd1\u800c\u7b2c\u4e8c\u6b21\u76f4\u63a5\u8bbf\u95ee\u4e8c\u8fdb\u5236\u901f\u5ea6\u63d0\u5347\u3002\u9996\u5148\u662f\u5206\u6790PHP\u4ee3\u7801\u5e76\u5c06\u5176\u8f6c\u6362\u4e3a\u79f0\u4f5cZend opcode\u7684\u4e8c\u8fdb\u5236\u683c\u5f0f(\u7c7b\u4f3cJava\u7684\u5b57\u8282\u7801)\u5e76\u5c06\u5176\u5b58\u50a8\u4e8e\u5185\u5b58\u4e2d\uff1b\u7b2c\u4e8c\u9636\u6bb5\u662f\u4f7f\u7528Zend Engine\u53bb\u6267\u884c\u8fd9\u4e9b\u8f6c\u6362\u540e\u7684Opcode(Opcode\u53ea\u80fd\u5728Zend\u5f15\u64ce\u5f53\u4e2d\u8fd0\u884c)\u3002<\/p>\n
<\/p>\n
SAPI\u63d0\u4f9b\u4e86\u4e00\u4e2a\u548c\u5916\u90e8\u901a\u4fe1\u7684\u63a5\u53e3\uff0c\u4f7f\u5f97PHP\u53ef\u4ee5\u548c\u5176\u4ed6\u5e94\u7528\u8fdb\u884c\u4ea4\u4e92\u6570\u636e\u3002php\u9ed8\u8ba4\u63d0\u4f9b\u4e86\u5f88\u591a\u79cdSAPI\uff0c\u5e38\u89c1\u7684\u7ed9apache\u7684mod_php5\uff0cCGI\uff0c\u7ed9IIS\u7684ISAPI\uff0c\u8fd8\u6709Shell\u7684CLI\u3002\u5bf9\u4e8e\u4e00\u4e2a\u57fa\u4e8eapache\u7684php\u5e94\u7528\uff0c\u5176\u8fd0\u884c\u6d41\u7a0b\u53ef\u4ee5\u7b80\u5355\u5f52\u7ed3\u5982\u4e0b\uff1a<\/p>\n
\r\napache -> httpd -> mod_phpfastcgi -> sapi -> php\r\n<\/pre>\nPHP\u7684Opcode<\/strong><\/span><\/div>\nOpcode\u662f\u4e00\u79cdPHP\u811a\u672c\u7f16\u8bd1\u540e\u7684\u4e2d\u95f4\u8bed\u8a00\uff0c\u5c31\u50cfJava\u7684ByteCode\uff0c\u6216\u8005.NET\u7684MSL\u3002\u5f53\u89e3\u91ca\u5668\u5b8c\u6210\u5bf9\u811a\u672c\u4ee3\u7801\u7684\u5206\u6790\u540e\uff0c\u4fbf\u5c06\u5b83\u4eec\u751f\u6210\u53ef\u4ee5\u76f4\u63a5\u8fd0\u884c\u7684\u4e2d\u95f4\u4ee3\u7801\uff0c\u4e5f\u79f0\u4e3a\u64cd\u4f5c\u7801\uff08Operate Code\uff0copcode\uff09\u3002Opcode cache\u7684\u76ee\u5730\u662f\u907f\u514d\u91cd\u590d\u7f16\u8bd1\uff0c\u51cf\u5c11CPU\u548c\u5185\u5b58\u5f00\u9500\u3002\u5982\u679c\u52a8\u6001\u5185\u5bb9\u7684\u6027\u80fd\u74f6\u9888\u4e0d\u5728\u4e8eCPU\u548c\u5185\u5b58\uff0c\u800c\u5728\u4e8eI\/O\u64cd\u4f5c\uff0c\u6bd4\u5982\u6570\u636e\u5e93\u67e5\u8be2\u5e26\u6765\u7684\u78c1\u76d8I\/O\u5f00\u9500\uff0c\u90a3\u4e48opcode cache\u7684\u6027\u80fd\u63d0\u5347\u662f\u975e\u5e38\u6709\u9650\u7684\u3002\u4f46\u662f\u65e2\u7136opcode cache\u80fd\u5e26\u6765CPU\u548c\u5185\u5b58\u5f00\u9500\u7684\u964d\u4f4e\uff0c\u8fd9\u603b\u5f52\u662f\u597d\u4e8b\u3002<\/p>\n
PHP\u6267\u884cPHP\u811a\u672c\u4ee3\u7801\u4e00\u822c\u4f1a\u7ecf\u8fc7\u5982\u4e0b4\u4e2a\u6b65\u9aa4(\u786e\u5207\u7684\u6765\u8bf4\uff0c\u5e94\u8be5\u662fPHP\u7684\u8bed\u8a00\u5f15\u64ceZend)\uff1a<\/p>\n
\r\n Scanning(Lexing) \u2014\u2014\u5c06PHP\u4ee3\u7801\u8f6c\u6362\u4e3a\u8bed\u8a00\u7247\u6bb5(Tokens)\r\n Parsing \u2014\u2014\u2014\u2014\u2014\u2014\u5c06Tokens\u8f6c\u6362\u6210\u7b80\u5355\u800c\u6709\u610f\u4e49\u7684\u8868\u8fbe\u5f0f\r\n Compilation \u2014\u2014\u2014\u5c06\u8868\u8fbe\u5f0f\u7f16\u8bd1\u6210Opocdes\r\n Execution \u2014\u2014\u2014\u2014\u987a\u6b21\u6267\u884cOpcodes\uff0c\u6bcf\u6b21\u4e00\u6761\uff0c\u4ece\u800c\u5b9e\u73b0PHP\u811a\u672c\u7684\u529f\u80fd\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"PHP\uff08\u5916\u6587\u540d:PHP: Hypertext Preprocessor\uff0c\u4e2d\u6587\u540d\uff1a\u201c\u8d85\u6587\u672c\u9884\u5904\u7406\u5668\u201d\uff09\u662f\u4e00\u79cd\u901a\u7528 […]<\/p>\n","protected":false},"author":1479,"featured_media":7797,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[55],"tags":[],"class_list":["post-136138","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-thread"],"acf":[],"_links":{"self":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/136138","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/users\/1479"}],"replies":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/comments?post=136138"}],"version-history":[{"count":4,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/136138\/revisions"}],"predecessor-version":[{"id":136559,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/136138\/revisions\/136559"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media\/7797"}],"wp:attachment":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media?parent=136138"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/categories?post=136138"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/tags?post=136138"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}