【发布时间】:2016-12-22 12:16:56
【问题描述】:
您好,我想编写这样的代码...您能举个例子说明如何实现吗?
$theclassvariable = new Myclass();
$theclassvariable->firstMethod()->secondMethod($param,$param);
非常感谢。
【问题讨论】:
-
你应该学习 OOP 的概念,请参阅 tutorialspoint.com/php/php_object_oriented.htm
-
查找“流利的界面”,但基本上你需要你的
firstMethod()返回$this -
您的问题需要更具体How do I ask a good question? 您想学习如何处理类?如何使用它们?或者,如何在同一行调用多个方法?