如何在PHP和MYSQL DB中存储一个或多个HTML结构,
<li class='ui-state-default ui-sortable full w4-4'>
<div class='element-handler'>
<a href='#edit-element' class='edit revs-edit-element'>Edit</a>
<a href='#del' class='del-element delete'>X</a>
</div>
<div class='element'>
<span class='element-name'>Element name</span>
</div>
<textarea rows='6' cols='10' class='text-shortcode'>
[revs_flexslider page='home'] [shortcode page='home']
[shortcode page='home'][revs_shortcode page='home']
</textarea>
</li>
并将其追加以追加
<ul id="contenitore" class="connectedSortable"></ul>
whit序列化
答案 0 :(得分:0)
在php变量中获取整个结构。
$structure = "<li class='ui-state-default ui-sortable full w4-4'>
<div class='element-handler'>
<a href='#edit-element' class='edit revs-edit-element'>Edit</a>
<a href='#del' class='del-element delete'>X</a>
</div>
<div class='element'>
<span class='element-name'>Element name</span>
</div>
<textarea rows='6' cols='10' class='text-shortcode'>
[revs_flexslider page='home'] [shortcode page='home']
[shortcode page='home'][revs_shortcode page='home']
</textarea>
</li>";
然后运行sql查询
insert into table (structure) values ('$structure');
检索它只需使用select语句。
select * from table_name;
和
中的select输出<ul id="contenitore" class="connectedSortable"><?php echo $select_output ?></ul>