【发布时间】:2018-07-27 10:58:40
【问题描述】:
在 apache 配置文件中如何连接两个字符串?
例如:
"hello" + "world"
// "helloworld"
为什么?
有人可能希望这样做来处理大标题,例如下面的Content-Security-Policy 是我的 CSP 的一个示例。您可以看到它的格式很好,便于维护,但是在标头中发送时它有不需要的空格。
Header set Content-Security-Policy "\
;default-src\
'self'\
;child-src\
'self'\
;connect-src\
'self'\
;font-src\
'self'\
https://*.gstatic.com\
;form-action\
'self';\
;frame-ancestors\
'self'\
;frame-src\
'self'\
;img-src\
'self'\
https://www.google.com/s2/favicons\
https://www.google-analytics.com\
https://*.gstatic.com\
https://*.googleapis.com\
;object-src\
'none'\
;script-src\
'self'\
'unsafe-eval'\
https://www.google-analytics.com\
https://*.googleapis.com\
;style-src\
'self'\
'unsafe-inline'\
https://*.googleapis.com\
;\
"
【问题讨论】:
-
您的意思是针对特定指令吗?
-
@madebydavid 更多的是一个语法问题,但我的情况是我设置了一个非常大的标题(CSP)
-
感谢语法 ;-) 以
;为前缀和额外的换行符 +1
标签: string apache string-concatenation