跳转至

编程语言

JS实现继承的几种方式

JS无法像其他高级语言那样通过extend直接实现继承。只通过一定方式来实现继承机制。常见的几种实现继承的方式有: 1. 对象冒充 2. call/apply方法 3. 原型链(prototype chain) 4. 混合方式(call/apply+prototype chain)

PHP反射API初探

1. 什么是反射

反射在百度百科里面的解释是“反射是一种计算机处理方式。有程序可以访问、检测和修改它本身状态或行为的这种能力。能提供封装程序集、类型的对象”。

PHP提供了对类、函数、方法以及拓展进行反射的能力。通过反射我们可以在动态运行程序时候,获取类的名字,参数,方法、注释等信息以及动态调用对象方法,通过这些可以实现自动生成文档、自动注入依赖,插件管理。

反射的优点: 1. 反射提高了程序的灵活性和扩展性。 2. 降低耦合性,提高自适应能力。 3. 它允许程序创建和控制任何类的对象,无需提前硬编码目标类。

How-To-Clear-PHP’s-Opcache

原文链接:https://ma.ttias.be/how-to-clear-php-opcache/

PHP can be configured to store precompiled bytecode in shared memory, called Opcache. It prevents the loading and parsing of PHP scripts on every request. This guide will tell you how to flush that bytecode Opcache, should you need it.

You may want to flush the APC (PHP < 5.5) or Opcache (PHP >= 5.5) in PHP when it has cached code you want to refresh. As of PHP 5.5, the APC cache has been replaced by Opcache and APC only exists as a user key/value cache, no longer a bytecode cache.