Can PHP directly call functions in a class without using new?
只争朝夕
只争朝夕 2022-12-23 12:12:24
0
1
1836

I have to do something new every time, which is very unaccustomed. Can I use the functions in the class directly? The purpose of using the class is to look at the static attributes inside, so that when operating redis or mysql, automatic connection and connection reuse can be realized without the need to perform the connection operation multiple times. If I have to add new every time I use it. Isn’t that the same as before?

I don’t know if there is such a method. I just started to relearn class recently.

只争朝夕
只争朝夕

reply all(1)
只争朝夕

I just thought of using static variables. The experiment was successful. I don’t need to consider rewriting everything with classes for the time being. I just don’t know if there are any side effects.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!