Can this function be implemented without the framework or pure PHP? There are many pages with the insert, delete, and modify function. there is only one add, delete, and modify method. other pages can also share this method without a framework. Is this a pure PHP function? There are many pages with the insert, delete, and modify function. Only one add, delete, and modify method can be used for other pages.
I used to write a method on a page to insert a database. The boss asked all pages to write one type, and others also used to share this insertion method to insert the database. How? Can it be implemented? The inserted data table names and fields are different. how can this problem be solved?
Reply to discussion (solution)
To write a function or class, you need to use the page to include it. you just need to pass the parameter when calling it.
Write a class.
The boss said that there must be a difference, so there is a parameter
Write a class and perform parameter passing in the method.
Write a class and perform parameter passing in the method.
How does ajax submit it to the class method of this file? For example, the file is index. php, the class is add, and the method is insert ()
Write a class and perform parameter passing in the method.
How does ajax submit it to the class method of this file? For example, the file is index. php, the class is add, and the method is insert ()
You directly go to inde. php introduces this class, and then instantiates this class when submitting the class, and then calls the method in it to write the database $ model = new add (); $ model-> insert ($ data ); $ data here is the data you pass.
Yes. The framework is also encapsulated by PHP ..
To call these methods directly at the front end, you only need to pass the corresponding parameters. you can define the specific method name.
Function insert (){
}
Function delete (){
}
Function edit (){
}