lamoni / markupbuilder
一个用于使用方法链和动态方法构建单级DOM对象的PHP类
v1.0.0
2015-03-25 01:03 UTC
Requires
- php: >= 5.4.16
This package is not auto-updated.
Last update: 2024-09-28 17:12:29 UTC
README
此类用于使用方法链和动态方法构建单级DOM对象。
依赖项
- PHP >= 5.4
注意事项
- 实现"包含"标签创建吗?
- 移除$elementName、$attributeName和$attributes属性,并通过方法参数传递这些数据吗?
示例
以下代码
$div = new \Lamoni\MarkupBuilder\MarkupBuilder(); echo $div->divOpen('myIDHere') ->class('myClassHere') ->madeUpAttribute('theValue') ->attribute_with_hyphen('theHyphenValue'); echo "CONTENT!"; echo $div->divClose();
将生成以下HTML
<div id="myIDHere" class="myClassHere" madeUpAttribute="theValue" attribute-with-hyphen="theHyphenValue"> Content </div>