PHP - OOP - Why is my function called twice?

前端 未结 5 1152
逝去的感伤
逝去的感伤 2021-01-17 05:00

I\'m facing a problem that my function is called twice everytime i submit my form

my form file with the call to the function:



        
5条回答
  •  一向
    一向 (楼主)
    2021-01-17 05:39

    Your class name is login. You do not have __construct(), and you have a function called login(). So when you instantiate the class, login() is called first since you did not define __construct() , method name same as class becomes the constructor. Then you are calling the login() function again. Hence its called twice.

提交回复
热议问题