久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

什么是字節碼緩存,如何在 PHP 中使用?

What is a bytecode cache and how can I use one in PHP?(什么是字節碼緩存,如何在 PHP 中使用?)
本文介紹了什么是字節碼緩存,如何在 PHP 中使用?的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

我在網上搜索并了解到可以編譯 PHP 代碼以提高性能.但是怎么做呢?我可以編譯面向過程和面向對象的 PHP 代碼嗎?

I searched on the Web and came to know that PHP code can be compiled to have performance boost. But how to do it? Can I compile both procedural and object oriented PHP code?

推薦答案

基本思路,執行PHP腳本時分兩步:

The basic idea, when executing a PHP script is in two steps :

  • 首先:以純文本形式編寫的 PHP 代碼被編譯為操作碼
  • 然后:執行那些操作碼.


當你有一個 PHP 腳本時,只要不修改,操作碼永遠是一樣的;因此,每次執行該腳本時都進行編譯階段是一種 CPU 時間的浪費.


When you have one PHP script, as long as it is not modified, the opcodes will always be the same ; so, doing the compilation phase each time that script is to be executed is kind of a waste of CPU-time.

為了防止冗余編譯,您可以使用一些操作碼緩存機制.

To prevent that redundant-compilation, there are some opcode caching mechanism that you can use.

一旦 PHP 腳本被編譯為操作碼,這些操作碼將保存在 RAM 中——并在下次執行腳本時直接從內存中使用;防止編譯一次又一次.

Once the PHP script has been compiled to opcodes, those will be kept in RAM -- and directly used from memory the next time the script is to be executed ; preventing the compilation from being done again and again.


使用最多的操作碼緩存是APC - Alternative PHP Cache :

  • 在 PECL 上查看以下載 APC 擴展
  • 這是手冊

一旦 APC 安裝并正確配置,您就無需在 PHP 代碼中修改任何內容:APC 將緩存操作碼,僅此而已 -- 該進程對您的應用程序完全不可見.

Once APC has been installed and configured properly, there is nothing you have to modify in your PHP code : APC will cache the opcodes, and that is all -- the process is totally invisible for your application.

這篇關于什么是字節碼緩存,如何在 PHP 中使用?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

相關文檔推薦

Joining 2 tables in SELECT(MYSQL/PHP)(在 SELECT(MYSQL/PHP) 中加入 2 個表)
How to make lt;option selected=quot;selectedquot;gt; set by MySQL and PHP?(如何使lt;option selected=“selectedgt;由 MySQL 和 PHP 設置?)
Auto populate a select box using an array in PHP(使用 PHP 中的數組自動填充選擇框)
PHP SQL SELECT where like search item with multiple words(PHP SQL SELECT where like search item with multiple words)
json_encode produce JSON_ERROR_UTF8 from MSSQL-SELECT(json_encode 從 MSSQL-SELECT 產生 JSON_ERROR_UTF8)
MySQL ORDER BY rand(), name ASC(MySQL ORDER BY rand(),名稱 ASC)
主站蜘蛛池模板: 欧美黄在线观看 | 99久久国产综合精品麻豆 | 亚洲高清一区二区三区 | 精品1区2区3区4区 | 色接久久 | 亚洲二区在线观看 | av黄色免费 | 久草成人 | 国产成人jvid在线播放 | 久久一日本道色综合久久 | 天天操夜夜看 | 天天干天天插天天 | 午夜精品网站 | 一区二区三区韩国 | 国产午夜精品视频 | 在线日韩视频 | 午夜无码国产理论在线 | 欧美激情亚洲 | 国产成人在线观看免费 | 欧美日韩在线观看视频网站 | 国产精品毛片 | 在线观看第一区 | 韩日在线| 青青草国产在线观看 | 成人久久18免费网站麻豆 | 一区二区三区国产视频 | 五月婷亚洲 | 97久久精品午夜一区二区 | 视频在线亚洲 | 亚洲福利在线观看 | 在线第一页 | 久久久综合色 | 夜久久| 成人精品一区二区三区中文字幕 | 国产欧美久久一区二区三区 | 成人精品一区亚洲午夜久久久 | 久久久久久久久一区 | 日韩在线不卡 | 国产激情小视频 | 一区在线观看 | 亚洲一区二区在线 |