You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

生产环境PHP响应转义HTML无法渲染,本地正常,疑涉Rust安装配置

PHP生产环境HTML转义异常问题

问题现象

  • 生产环境:PHP接口返回的HTML字符被转义,前端无法正常渲染
  • 本地/开发环境:接口返回原始HTML标签,前端可正常解析渲染

诱因猜测

此前为测试部署Rust脚本(安装命令:curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh),配置过Apache反向代理,怀疑该操作引发了此问题。已卸载相关Apache模块,并删除了.conf文件中的对应配置,但问题仍未解决。

HTTP请求头对比

生产环境请求头

Request URL:
https://www.website.com/app/ajax/entry/note/get-new-note-view.php
Request Method:
POST
Status Code:
200 OK
Remote Address:
164.92.119.217:443
Referrer Policy:
strict-origin-when-cross-origin
cache-control:
no-cache, no-store, must-revalidate
connection:
Keep-Alive
content-encoding:
gzip
content-length:
1474
content-type:
text/html; charset=utf-8
date:
Tue, 18 Feb 2025 00:15:05 GMT
expires:
0
keep-alive:
timeout=5, max=100
pragma:
no-cache
server:
Apache/2.4.41 (Ubuntu)
vary:
Accept-Encoding
accept:
application/json, text/javascript, */*; q=0.01
accept-encoding:
gzip, deflate, br, zstd
accept-language:
en-US,en;q=0.9
connection:
keep-alive
content-length:
25
content-type:
application/x-www-form-urlencoded; charset=UTF-8
cookie:
__stripe_mid=f221d5df-c6c1-4ad1-aa70-67c8556062e6efba90; personnel_id=1; PHPSESSID=2n0e902a3brd7hi2shcnuipjk2; __stripe_sid=588f6b12-46ff-4fe3-9e28-9618d07a46e0eac31d; cookie_random_string=ar00HbYeTINvqs7lmOgurFFZCKQSDjnd
host:
www.website.com
origin:
https://www.website.com
referer:
https://www.website.com/app?sec=new-note
sec-ch-ua:
"Not(A:Brand";v="99", "Google Chrome";v="133", "Chromium";v="133"
sec-ch-ua-mobile:
?0
sec-ch-ua-platform:
"Windows"
sec-fetch-dest:
empty
sec-fetch-mode:
cors
sec-fetch-site:
same-origin
user-agent:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/133.0.0.0 Safari/537.36
x-requested-with:
XMLHttpRequest

本地环境请求头

Request URL:
http://localhost/app/ajax/entry/note/get-new-note-view.php
Request Method:
POST
Status Code:
200 OK
Remote Address:
[::1]:80
Referrer Policy:
strict-origin-when-cross-origin
cache-control:
no-store, no-cache, must-revalidate
connection:
Keep-Alive
content-length:
4540
content-type:
text/html; charset=UTF-8
date:
Tue, 18 Feb 2025 00:15:13 GMT
expires:
Thu, 19 Nov 1981 08:52:00 GMT
keep-alive:
timeout=5, max=98
pragma:
no-cache
server:
Apache/2.4.46 (Win64) OpenSSL/1.1.1h PHP/8.0.2
x-powered-by:
PHP/8.0.2
accept:
application/json, text/javascript, */*; q=0.01
accept-encoding:
gzip, deflate, br, zstd
accept-language:
en-US,en;q=0.9
connection:
keep-alive
content-length:
25
content-type:
application/x-www-form-urlencoded; charset=UTF-8
cookie:
__stripe_mid=9be9288f-f182-4059-aa0c-018babef617275e418; PHPSESSID=mcgb3t1spmuec3ue6fbj63egoi; personnel_id=1; cookie_random_string=jPuTmva9QCa0oROMhR8aQgYV92yPjUcq; __stripe_sid=0389a808-dfec-47f6-8720-47e74239fd4c2c79dd
host:
localhost
origin:
http://localhost
referer:
http://localhost/app?sec=new-note
sec-ch-ua:
"Not(A:Brand";v="99", "Google Chrome";v="133", "Chromium";v="133"
sec-ch-ua-mobile:
?0
sec-ch-ua-platform:
"Windows"
sec-fetch-dest:
empty
sec-fetch-mode:
cors
sec-fetch-site:
same-origin
user-agent:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/133.0.0.0 Safari/537.36
x-requested-with:
XMLHttpRequest

疑问

  1. 如何让生产环境的输出与本地环境一致?
  2. 问题是否出在Apache的.conf配置或Rust安装相关的其他配置上?
  3. 还需要提供哪些额外信息?

内容的提问来源于stack exchange,提问作者HC_

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.14 07:04:59