Common CRUD functions in PHP

后端 未结 8 1183
闹比i
闹比i 2020-12-28 10:48

Is there a simple way to write a common function for each of the CRUD (create, retreive, update, delete) operations in PHP WITHOUT using any framew

8条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-12-28 11:10

    it is possible but I wouldn't recommend it.

    If there's absolutely NO way to use a framework you could create a base class that all other model objects extend. You can then make the base class generate & execute SQL based on get_class() and get_class_vars().

    Is it possible? Yes.
    Would I recommend it? nope

提交回复
热议问题