【发布时间】:2017-03-05 10:24:13
【问题描述】:
我有 2 个班级 - A 和 B 两者都应该使用来自 .ini 或 .php 的配置文件。 并且都有方法调用 post 从不同的 api 获取 smth 最好的设计方法是什么?
我是否需要使用抽象并将配置放入他的构造函数中。 ? 我只需调用 $this->config?
就可以获取配置例如:
abstract class parent
{
constructor()
{
$this->config = "get file";
}
}
class a extends parent {
...
how to use $this->conifg ?
}
非常感谢
【问题讨论】: