Comments (5)
如果你想实现,不同的类包含不同的实例,也就是你期望的结果。
那么你只需将 trait
中的 protected static $instance = null;
修改为 private static $instance = null;
即可。
from doc-zh.
补充下,这个问题是属性继承问题。只有 设置为 private
的时候,每个类的属性才会不同。具体可以看下相关可访问性不同导致的变化。
from doc-zh.
@mowangjuanzi 正常的类里面,父类中的属性被子类重写了。但是用trait提取公共部分,并没有被重写。
from doc-zh.
@mowangjuanzi php/php-src#10937 辛苦看看这个是否是调整
from doc-zh.
Duplicate of php/php-src#10935
Fixed via php/php-src@9a250cc
这个实现会在 PHP 8.3 中包含。
from doc-zh.
Related Issues (20)
- bugbugbugbug HOT 1
- 使用telnet协议,$match全是null的 HOT 1
- 从官网中下载下来的chm文件类似渲染缺失 HOT 2
- Document Missing HOT 1
- When the value is negative, the return value is incorrect HOT 5
- spl_autoload_register 中文翻译 typo HOT 1
- the item "serialize_precision" is now default 17 not -1; Prior to PHP 7.1.0, the default value was -1. HOT 3
- 中文版本下有字错误 “仅管 enum 可以包括 public、private、protected 的方法” HOT 1
- openssl_pkey_get_details 未知类型返回值说明错误 HOT 1
- 未定义和 unset() 的变量豆浆解析为值 null。 HOT 1
- 但该函数扔可能会终止。 HOT 1
- 并且有许多的 IP 地址讲导致在 32 位系统的情况下为负数 HOT 1
- 未翻译php8 str-新增函数 HOT 1
- 示例9中文翻译有误 HOT 1
- 函数is_object中文翻译不准确 HOT 1
- 在php.ini中设置了拓展路径,也打开了拓展,php_musqli.dll文件也在ext文件夹下,web服务器也进行了重启,为什么还是无法安装mysqli拓展 HOT 1
- $matches前多了一个字符。
- a word spell wrong
- ksort sorting is inconsistent HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from doc-zh.