Is it possible in PHP to prevent “Fatal error: Call to undefined function”?

后端 未结 6 1969
鱼传尺愫
鱼传尺愫 2020-12-03 17:31

In PHP, is there any way that I can ignore functions that are undefined instead of throwing a fatal error that is visible in the browser?—i.e., Fatal error: Call to

6条回答
  •  Happy的楠姐
    2020-12-03 17:57

    What you are asking for seems a little goofy, but you can get a similar effect by declaring all your functions as methods of a class and then implement __call as a method of that class to handle any undefined method calls. You can then handle calls to undefined methods however you like. Check out the documentation here.

提交回复
热议问题