3
我有使用json_encode解析HTML字符串的問題。例如我的字符串:Json_Encode與Twig中的Html字符串
<h5>Name</h5>
作爲回報,我的json因「>」而被破壞。我發現在PHP的解決方案:
json_encode('ARRAY', 'JSON_HEX_QUOT | JSON_HEX_TAG')
但我需要在TWIG做它,它不起作用。我有錯誤:
An exception has been thrown during the rendering of a template ("Warning: json_encode() expects parameter 2 to be long, string given") in src/Cloud/ApplicationBundle/Resources/views/Filters/tab.html.twig at line 1.