I'm new to PHP and before I waste a lot of time doing things the hard way, I wanted to find out if there are shortcuts/techniques to creating PHP web forms apps. All this app will do is display web forms with data from 1 or more tables. In addition to displaying data, the user must be able to update the form and add new data to the forms. I know how to to do all this by manually writing all the PHP/HTML code. But I'm looking for anything that can save me time.
我是PHP的新手,在我浪费大量时间做事之前,我想知道是否有创建PHP Web表单应用程序的快捷方式/技巧。所有这个应用程序将使用来自一个或多个表的数据显示Web表单。除了显示数据之外,用户还必须能够更新表单并向表单添加新数据。我知道如何通过手动编写所有PHP / HTML代码来完成所有这些操作。但我正在寻找任何可以节省时间的东西。
Unfortunately, I can't use any of the fancy PHP libraries such as CakePHP for this. I'm restricted to using the core PHP framework, Oracle for the database and the OCI library for Oracle access.
不幸的是,我不能使用任何奇特的PHP库,如CakePHP。我只限于使用核心PHP框架,Oracle用于数据库,OCI库用于Oracle访问。
Given these constraints, what the easiest way to support CRUD operations in a basic PHP forms app? Are there code generators or other tools that can help?
鉴于这些限制,在基本PHP表单应用程序中支持CRUD操作的最简单方法是什么?是否有代码生成器或其他工具可以提供帮助?
2 个解决方案
#1
4
Unfortunately, I can't use any of the fancy PHP libraries such as CakePHP for this. I'm restricted to using the core PHP framework,
不幸的是,我不能使用任何奇特的PHP库,如CakePHP。我只限于使用核心PHP框架,
Most PHP frameworks are written in PHP. So you wouldn't have to install anything to use them.
大多数PHP框架都是用PHP编写的。所以你不必安装任何东西来使用它们。
That said, forms are rather non-trivial. Treating a form as a separate component only works to some extend. Because of that, many frameworks have forms deeply integrated into them, and not as a standalone component.
也就是说,形式是非常重要的。将表单作为单独的组件处理仅在某种程度上起作用。因此,许多框架都将表单深深地集成到它们中,而不是作为独立组件。
You could take a peek at Zend Framework's Form component. It's fairly self-sufficient and feature-rich.
你可以看看Zend Framework的Form组件。它相当自给自足,功能丰富。
#2
0
I build all of my forms on top of a "fillInFormValues($html, $request, $formErrors);" function. See my article at OnLamp for details and full source code.
我在“fillInFormValues($ html,$ request,$ formErrors)”之上构建了所有表单;“功能。有关详细信息和完整源代码,请参阅OnLamp上的文章。
#1
4
Unfortunately, I can't use any of the fancy PHP libraries such as CakePHP for this. I'm restricted to using the core PHP framework,
不幸的是,我不能使用任何奇特的PHP库,如CakePHP。我只限于使用核心PHP框架,
Most PHP frameworks are written in PHP. So you wouldn't have to install anything to use them.
大多数PHP框架都是用PHP编写的。所以你不必安装任何东西来使用它们。
That said, forms are rather non-trivial. Treating a form as a separate component only works to some extend. Because of that, many frameworks have forms deeply integrated into them, and not as a standalone component.
也就是说,形式是非常重要的。将表单作为单独的组件处理仅在某种程度上起作用。因此,许多框架都将表单深深地集成到它们中,而不是作为独立组件。
You could take a peek at Zend Framework's Form component. It's fairly self-sufficient and feature-rich.
你可以看看Zend Framework的Form组件。它相当自给自足,功能丰富。
#2
0
I build all of my forms on top of a "fillInFormValues($html, $request, $formErrors);" function. See my article at OnLamp for details and full source code.
我在“fillInFormValues($ html,$ request,$ formErrors)”之上构建了所有表单;“功能。有关详细信息和完整源代码,请参阅OnLamp上的文章。