Class library, how to use it, is there any detailed method?
哈哈哈哈。2018-07-12 11:54:40
0
6
1168
My MySQL class library in PHP can only define variables after loading it with include. How to use the functions in it? It is useless to write the function name directly.
Class libraries are generally used for inheritance. Your own project class inherits the extends class library. In this way, you can use the methods and things inside it in your own class. Do you understand this?
replyI think only referring to it is equivalent to loading But it doesn't say how to use the functions inside. What should I add before using the function inside? I don’t know mainly this.
replyWhen you create a new object, just use the object to call the method in the class; for example, $a = new b(); $c = $a->d(); $c is what class b gets after calling class d method of class b. the result of;
Class libraries are generally used for inheritance. Your own project class inherits the extends class library. In this way, you can use the methods and things inside it in your own class. Do you understand this?
You can take a look at this: https://blog.csdn.net/toume/article/details/80995979
Directly copy the code encapsulated in the class library into your program, and then call it.