strategies for managing long class files in php

前端 未结 6 797
野的像风
野的像风 2021-02-09 08:37

I\'ve got a bunch of functions that I want to move into a class. They\'re currently split into a couple of fairly long files. I\'d prefer not to have one 2500 line file, but as

6条回答
  •  傲寒
    傲寒 (楼主)
    2021-02-09 09:11

    This class/set of functions outputs the html for a complex form.

    Why not remove PHP from the equation? It seems you're using PHP to organize views which can be done easily with the filesystem. Just write the views in HTML with as little PHP as possible. Then use PHP to map requests to views. I'm assuming you're processing forms with PHP, and you could continue to do so. However, your classes will become much smaller because they're only accepting, verifying and presumably saving input.

提交回复
热议问题