直接输出接收的数据
#include <stdio.h>
#include <stdlib.h>
main()
{
int i,n;
printf ("Content-type:text/plain
");
n=0;
if(getenv("CONTENT_LENGTH"))
{
n=atoi(getenv("CONTENT_LENGTH"));
for (i=0;i<n;i++)
putchar(getchar());
putchar ('
');
fflush(stdin);
}
else
printf("error");
}
ps.环境变量是“CONTENT_LENGTH”,而不是“CONTENT-LENGTH”,很多博主代码都有各种小错误,坑了我一把。