Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
你的问题是这一行:
$factory = new MenuFactory();
你不需要它。只需将其删除。MenuFactory这将使用其默认设置创建一个新的。当我像这样创建自己的时,我自己会遇到一些有线行为factory。
MenuFactory
factory