问题
Is there a PHP HTML tag library for doing server-side HTML tags? Java and ASP.NET have these but those are compiled langs vs. scripted. For example, in ASP.NET, you define a textbox control using this:
<asp:TextBox />
And you can reference it server-side and assign properties, etc. Wasn't sure if such capability exists for PHP. Thanks.
回答1:
There's not a built-in way to do it but template systems can add similar functionality. I personally use Smarty. It's not quite the same but it's similar.
For example, check boxes:
{ html_checkboxes name="foo" }
Or a date picker
{ html_select_date time=$some_unix_timestamp }
Also easy to extend it with plug-ins
回答2:
Some frameworks have some implementations of this approach, e.g. form helper in CodeIgniter or view helpers in Zend framework.
来源:https://stackoverflow.com/questions/4196955/is-there-a-php-html-tag-library