Call function inside __construct with php

一笑奈何 提交于 2019-12-07 07:14:46

问题


A simple PHP problem I couldn't find the answer to.

Is it possible to call a function from the "__construct()"?

For example if I use the My_Controller solution here. If I add my own function below, like if I have a more advanced auth, can I call it from the construct?


回答1:


Yes, using the format $this->myNewFunction();



来源:https://stackoverflow.com/questions/6533724/call-function-inside-construct-with-php

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!