css - 编码在样式应答器中不起作用
问题描述
我正在使用 symfony,在我的控制器中我有类似的东西:
$colors =" test > test2{
color : #fff
}";
return $this->render(
'Default/views/page.html.twig',
array("colors" =>$colors)
);
在我的树枝上,我有:
<style>
{{ colors }}
</style>
但问题不是>
我有>
,所以我的风格不适用。但如果我{{ colors }}
在我之外做,script
我有正确的>
解决方案
colors
var 出于安全原因被转义,{{ colors|raw }}
如果您确定自己在做什么,则必须使用。
推荐阅读
- apache-kafka - 未指定默认 serdes 并使用自定义 serdes -> org.apache.kafka.streams.errors.StreamsException 时,KStream 上的映射操作失败
- vba - 导航时需要让 Excel 重新将过滤器应用到活动工作表
- php - Heroku 在第 4 行的 /app/index.php 中没有这样的文件或目录
- eslint - 是否有 ESLint 规则在作业上对齐 `=`
- google-cloud-storage - 如何使用应用引擎触发新训练数据的训练作业并在 Cloud ML 上部署新模型?
- php - php curl 响应显示 gzip 或编码数据
- docker - 如何在 Docker 容器中保留 go 1.11 模块?
- node.js - 使用文件作为 NodeJS 或 express 服务器的本地存储?
- c++ - 添加颠倒的数字
- mamp - MAMP 无法在系统启动时启动