php - 在 json_encode($json, JSON_UNESCAPED_SLASHES) 中转义 css 类的方法
问题描述
我有一个 php 文件,它填充变量并将它们集成到一个 html 表中。为此,我将 json_encode 与 JSON_UNESCAPED_SLASHES 一起使用,以便我可以动态加载它们并且格式正确。(出于过滤原因)
但我的问题似乎是不再代表 css 类,因为我使用了 JSON_UNESCAPED_SLASHES,所以我不知道如何逃脱。
$json = '<thead>
<tr>
<th>Herkunft</th>
<th>Altersstaffelung</th>
<th>Punktwert</th>
<th>Anzahl Mitglieder</th>
<th>Anzahl Famis</th>
<th>Versicherte Gesamt</th>
<th>Punkte</th>
<th>Anzahl Mitglieder</th>
<th>Anzahl Famis</th>
<th>Versicherte Gesamt</th>
<th>Punkte</th>
<th>Summe</th>
</tr>
</thead>
<tbody>
<tr class="gkv">
<td rowspan="2"><p>GKV/PKV</p> (mit oder ohne Vertriebspartnerbeteiligung)</td>
<td>bis 30 Jahre</td>
<td>5</td>
<td> '.$Mitglied_GKV_PKV_j.'</td>
<td>'.$Fami_GKV_PKV_j.'</td>
<td>'.$Versicherte_GKV_PKV_j.'</td>
<td>'.$Punkte_GKV_PKV_j.'</td>
<td>'.$Mitglied_GKV_PKV_j_vp.'</td>
<td>'.$Fami_GKV_PKV_j_vp.'</td>
<td>'.$Versicherte_GKV_PKV_j_vp.'</td>
<td>'.$Punkte_GKV_PKV_j_vp.'</td>
<td>'.$Summe_GKV_PKV_j_vp.'</td>
</tr>
</tbody>';
echo json_encode($json, JSON_UNESCAPED_SLASHES);
除了 rowspan 和 css 类之外,一切都很好。
解决方案
推荐阅读
- twilio - 自动驾驶仪和 Studio 集成
- ruby-on-rails - Rails 6 - 如何使用旧的 sprocket 资产管道而不是 webpacker?
- javascript - 启用后单击触发器在禁用按钮上不起作用
- javascript - 删除了 Class 并希望将其添加回来
- constraints - QGIS3条目约束强制执行非空约束但允许零作为值
- unity3d - unity不显示对撞机
- javascript - 为什么这两个函数有这么大的性能差异?我改变的是价值声明的地方
- c# - 在 FormCollection MVC 表单中传递的复选框值
- javascript - 获取网页的 URL,不包括组件的 URL
- node.js - Nodejs后端如何摆脱html标签