{"id":199788,"date":"2020-11-08T09:56:26","date_gmt":"2020-11-08T01:56:26","guid":{"rendered":"http:\/\/4563.org\/?p=199788"},"modified":"2020-11-08T09:56:26","modified_gmt":"2020-11-08T01:56:26","slug":"php7-4-%e5%b7%b2%e7%bb%8f%e6%9c%89-preload-%e5%92%8c-ffi-%e4%ba%86%ef%bc%9f","status":"publish","type":"post","link":"http:\/\/4563.org\/?p=199788","title":{"rendered":"PHP7.4 \u5df2\u7ecf\u6709 preload \u548c ffi \u4e86\uff1f"},"content":{"rendered":"<div>\n<div>\n<div>\n<h1>                  PHP7.4 \u5df2\u7ecf\u6709 preload \u548c ffi \u4e86\uff1f               <\/h1>\n<p> <\/p>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : liuxu <\/span>  <span><i><\/i> 3<\/span> <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<\/p><\/div>\n<div isfirst=\"1\">                        https:\/\/www.php.net\/manual\/en\/opcache.preloading.php<br \/>https:\/\/www.php.net\/manual\/en\/ffi.examples-complete.php<\/p>\n<p>\u73b0\u5728 php \u53ef\u4ee5\u76f4\u63a5\u8c03\u7528 c \u4ee3\u7801\u4e86\uff0copenresty \u7684 luajit \u8c03\u7528 c \u4e5f\u662f\u7528\u7684 ffi      <\/p><\/div>\n<div> <b>\u5927\u4f6c\u6709\u8a71\u8aaa<\/b> (<span>15<\/span>)        <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<ul>\n<li data-pid=\"4265928\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : cccp2020 <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             preload \u662f 7.4 \u7684\u91cd\u8981\u7279\u6027<\/p>\n<p>https:\/\/segmentfault.com\/a\/1190000021234312 \u53d1\u4e2a\u5f53\u5e74\u7ffb\u8bd1\u548c\u6574\u7406\u7684\u5173\u4e8e preload \u7684\u6587\u7ae0                                                            <\/p><\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4265929\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : barbery <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u4e0d\u9519\uff0c\u6709\u70b9\u610f\u601d\uff0c\u4ee5\u540e\u6846\u67b6\u4ee3\u7801\u4e0d\u7528\u6bcf\u6b21\u90fd\u52a8\u6001\u52a0\u8f7d\u4e86                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4265930\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : liuxu <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u91cd\u70b9\u662f\u8fd8\u6709 ffi\uff0c\u76f4\u63a5\u7528 c \u5199\u597d\u4ee3\u7801\uff0c\u7136\u540e ffi \u76f4\u63a5\u8c03\u7528 c \u65b9\u6cd5\uff0c\u6027\u80fd\u98d9\u5347\u554a                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4265931\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : vus520 <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u4e0d\u597d\u610f\u601d\uff0cphp \u8fdb\u5316\u5f97\u4ed6\u5988\u90fd\u4e0d\u8ba4\u8bc6\u4e86\u3002<\/p>\n<p>\u8fd9\u4e48\u590d\u6742\u6211\u4e3a\u4ec0\u4e48\u4e0d\u7528 Go \uff1f                                                            <\/p><\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4265932\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : liuxu <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             [email&#160;protected]:~\/phpffi\/helloworld$ ls<br \/>helloworld.c helloworld.php libhelloworld.so<br \/>[email&#160;protected]:~\/phpffi\/helloworld$ cat helloworld.{c,php}<br \/>#include &lt;stdio.h&gt;<\/p>\n<p>void helloworld()<br \/>{<br \/> printf(&#8220;hello world!n&#8221;);<br \/>}<br \/>&lt;?php<\/p>\n<p>$ffi = ffi::cdef(<br \/> &#8220;void helloworld();&#8221;,<br \/> &#8220;.\/libhelloworld.so&#8221;<br \/>);<\/p>\n<p>$ffi-&gt;helloworld();<br \/>[email&#160;protected]:~\/phpffi\/helloworld$ php helloworld.php <br \/>hello world!<br \/>[email&#160;protected]:~\/phpffi\/helloworld$ php &#8211;version<br \/>PHP 7.4.11 (cli) (built: Oct 10 2020 19:44:50) ( NTS )<br \/>Copyright (c) The PHP Group<br \/>Zend Engine v3.4.0, Copyright (c) Zend Technologies<br \/> with Zend OPcache v7.4.11, Copyright (c), by Zend Technologies<br \/>[email&#160;protected]:~\/phpffi\/helloworld$ php -m | grep -i ffi<br \/>FFI                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4265933\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : liuxu <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @vus520 golang \u8c03\u7528 c \u4e5f\u662f\u86ee\u590d\u6742\u7684\uff0cffi \u8c03\u7528\u5f88\u9999\u4e86                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4265934\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : lovecy <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @vus520 \u7b80\u5355\u53c8\u8bf4\u5f00\u53d1\u4e0d\u4e86\u5927\u578b\u7a0b\u5e8f\uff0c\u590d\u6742\u53c8\u8bf4\u4e3a\u5565\u4e0d\u7528(JAVA, go)                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4265935\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : cmdOptionKana <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @liuxu golang \u53ef\u4ee5\u5927\u91cf\u51cf\u5c11\u8c03\u7528 C \u7684\u9700\u6c42                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4265936\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : liuxu <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @cmdOptionKana \u6240\u4ee5\u5c31\u6ca1\u6cd5\u8bf4\u5230\u4e00\u8d77\u53bb\u3002\u3002\u53c8\u4e0d\u662f\u4e0d\u4f1a golang\uff0c\u53ea\u662f\u5728\u8ba8\u8bba php \u6709\u8da3\u7684\u529f\u80fd\u800c\u5df2\uff0cv2ex \u6709\u8c01\u4e0d\u77e5\u9053 golang \u6027\u80fd\u6bd4 php \u597d\u5417\u3002\u3002\u5b9e\u5728\u662f\u592a\u65e0\u8da3\u4e86\u3002\u3002                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4265937\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : NjcyNzMzNDQ3 <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             packagist \u4f1a\u6709\u66f4\u591a\u7684 C \u8bed\u8a00\u5305\u4e86\uff0c\u9999\u8d77\u6765\u4e86                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4265938\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : ben1024 <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u8fd9\u3002\u3002\u3002\u8fc7\u51e0\u5929 PHP 8 \u5c31\u51fa\u6765\u4e86                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4265939\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : Felldeadbird <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u6ca1\u8bb0\u9519\uff0cPHP7.4 \u652f\u6301\u7279\u5f81\uff0c\u8c03\u7528 C \u7684\u5199\u6cd5 \u76f8\u6bd4\u8d77\u6211\u5199 C \u4e0d\u662f\u66f4\u5feb\u5417\uff1f<\/p>\n<p>\u4e0d\u8fc7\u603b\u8981\u6709\u4eba\u8e0f\u51fa\u7b2c\u4e00\u6b65\uff0c\u540e\u4eba\u7ee7\u7eed\u5b8c\u5584\u3002                                                            <\/p><\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4265940\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : sunznx <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u4e0a\u7684 \u67d0 sb \u5df2 block                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4265941\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : CODEWEA <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u4f46\u662f php \u5728 web \u573a\u666f\u4e0b\u5f88\u5c11\u4f1a\u8c03\u7528 c \u5427\uff1f\u6709\u4ec0\u4e48\u573a\u666f\u5417\uff0c\u4e3e\u4e2a\u4f8b\u5b50\u3002                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4265942\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : lideshun123 <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             php \u5728\u4e0d\u65ad\u8fdb\u6b65\uff0c\u771f\u5fc3\u611f\u8c22\u8fd9\u4e9b\u4e3a php \u6dfb\u7816\u52a0\u74e6\u7684\u5927\u4f6c\u4eec\uff0c\u90a3\u4e9b\u6760\u5934\u4eec\uff0cgo \u597d java \u597d\u4f60\u4eec\u53bb\u7528\u4f60\u4eec\u7684\uff0c\u4f60\u53ea\u8981\u5403\u8fc7 php \u7684\u996d\uff0c\u5728\u8fd9\u4e0d\u597d\u90a3\u4e0d\u597d\uff0c\u90a3\u5c31\u662f\u7aef\u8d77\u7897\u5403\u996d \u653e\u4e0b\u7b77\u5b50\u9a82\u5a18\u3002\u8bed\u8a00\u5c31\u662f\u8d5a\u94b1\u7684\u5de5\u5177\u800c\u5df2\uff0c\u4ed6\u597d\u4e0d\u597d\u5728\u4e8e\u4f60\u600e\u4e48\u7528\u7684\u53bb\u8d5a\u94b1\uff0c\u8bed\u8a00\u6709\u597d\u574f\u4e48\uff1f                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li>\n","protected":false},"excerpt":{"rendered":"<p>PHP7.4 \u5df2\u7ecf\u6709 preloa&hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[],"tags":[],"_links":{"self":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/199788"}],"collection":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=199788"}],"version-history":[{"count":0,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/199788\/revisions"}],"wp:attachment":[{"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=199788"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=199788"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=199788"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}