2015-11-24 20:09
浏览 23


How can I extend multiple classes like this:

class Backend_api extends CI_Controller, Appointments
        do stuff...

图片转代码服务由CSDN问答提供 功能建议


  class  Backend_api扩展了CI_Controller,Appointments 
 do stuff ... 
  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

3条回答 默认 最新

  • douzi8548 2015-11-25 06:19

    As mentioned, multiple inheritance is not allowed in php, but if you need to access functions in the Appointments class, why not just create an instance of it in the class and call the function on that instance?

    $ins = new Appointments();
    $result = $ins->someFunction();
    打赏 评论
  • dongshan4316 2015-11-24 20:11

    PHP does not support multiple inheritance

    打赏 评论
  • dqaxw44567 2015-11-24 20:13

    As already mentioned, PHP does not support multiple inheritance. But since PHP5.4 you can use traits and use them in your classes. More info about traits here

    打赏 评论

相关推荐 更多相似问题