gpt4 book ai didi

php - 将 arrayaccess 与静态类一起使用

转载 作者:行者123 更新时间:2023-12-05 08:24:32 25 4
gpt4 key购买 nike

我如何在我的静态类中使用数组访问?F.e.我喜欢执行下一个脚本:

class A {
...
}
A['p'] = 15;
echo isset(A['p']) ? A['p'] : 0;

最佳答案

interface ArrayAccess仅适用于对象。静态访问没有任何相似之处。

关于php - 将 arrayaccess 与静态类一起使用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2575149/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com