PHP7安装后确实只有标题,但是只要改一下代码就可以修复:
vendor/zendframework/zend-diactoros/src/Response/JsonResponse.php 第100行左右:
private function jsonEncode($data, $encodingOptions)
{
if (is_resource($data)) {
throw new InvalidArgumentException('Cannot JSON encode resources');
}
// Clear json_last_error()
json_encode(null);
$json = json_encode($data, $encodingOptions | JSON_PARTIAL_OUTPUT_ON_ERROR);
json_encode(null);
if (JSON_ERROR_NONE !== json_last_error()) {
throw new InvalidArgumentException(sprintf(
'Unable to encode data to JSON in %s: %s',
__CLASS__,
json_last_error_msg()
));
}
return $json;
}