PHP 操作码缓存是否与 __autoload 一起使用? [英] Do PHP opcode cache work with __autoload?

查看:21
本文介绍了PHP 操作码缓存是否与 __autoload 一起使用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

对不起,如果这是基本的,我正在尝试尽可能多地学习 PHP 中的 OO,并且我正在慢慢学习如何使用它(非常有限).

Sorry if this is basic, I am trying to learn as much as I can about OO in PHP and I am slowly learning how to use it (very limited).

所以我想知道 __autoload() 是否对 PHP 操作码缓存有任何影响?

So I am wanting to know if __autoload() has any affect on PHP opcode cache's?

推荐答案

(免责声明:我只知道APC)

操作码缓存的作用是:

  • 当一个文件被包含/需要时,它采用该文件的完整路径
  • 检查对应于该文件的操作码是否已经在 RAM 中(在操作码缓存中)
    • 如果是,返回这些操作码以便执行
    • 如果不是,则加载文件并将其编译为操作码;并将操作码存储在缓存中.

    这里的重点是入口点:文件的完整路径.

    The important point, here, is the entry point : the full path to the file.


    自动加载通常做的是:


    What autoloading generally do is :

    • 获取类名
    • 将其转换为文件名
    • 包含/要求该文件

    因此,与操作码缓存相关的信息(文件的完整路径,以及它被包含/需要的事实)仍然存在.

    So, the informations that are relevant for the opcode cache (full path to the file, and the fact that it is included/required) are still here.

    因此,自动加载不应该给操作码缓存带来任何麻烦.

    In consequence, autoload shouldn't bring any trouble with op code caching.

    (而且,在使用 APC 时,它没有,据我所知)

    这篇关于PHP 操作码缓存是否与 __autoload 一起使用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆