最近使用docker搞了一个Php8的版本,但是遇到一个很奇怪的问题。在post数据的后返回的结果会把请求体的参数一起返回回来 比如如下
curl -X POST \
http://test.com/open/test \
-H 'cache-control: no-cache' \
-H 'content-type: application/json' \
-H 'postman-token: d357ac6d-c2f0-237f-baa8-dbc6c759d6e2' \
-d '{
"commodity_id": 1
}'
返回的结果如下
{"commodity_id": 1}{"code":success}
真正的相应前面带了个请求体。
目前docker php8.0.2有这个问题,PHP-BUG网站上也有这个问题描述
https://bugs.php.net/bug.php?...
我的环境:
机器:CentOS Linux release 7.8.2003 (Core)
php-docker : https://github.com/docker-lib...
nginx: nginx/1.12.1
测试: 使用Post方法提交表单信息,刚启动的容器是正常的,过一段时间就会出现描述的问题,测试文件内容只需要一个Index.php 包含内容
<?php
echo 'string';
exit;
测试数据:
curl -X POST \
http://test.com/ \
-H 'cache-control: no-cache' \
-H 'content-type: application/x-www-form-urlencoded' \
-H 'postman-token: 7783c00c-347f-e74f-7316-2a9bb632eb47' \
-d points=10
我本地的mac环境倒是正常的,但是服务器不正常
这和PHP无关,是你的接口自己输出的内容。