我设置

header('Content-Type', 'application/json');

但是没生效,response中的content-type还是为:

text/html; charset=UTF-8

原来是因为header里面只能设置一个字符串,

应该设置为:

header('Content-Type:application/json');

更多推荐

Content-Type设置后但没生效