diff --git a/library/think/Input.php b/library/think/Input.php index 848be817..a6445b2d 100644 --- a/library/think/Input.php +++ b/library/think/Input.php @@ -465,7 +465,11 @@ class Input // 字符串 case 's': default: - $data = (string) $data; + if (is_scalar($data)) { + $data = (string) $data; + } else { + throw new Exception('变量类型不允许:' . gettype($data)); + } } } } diff --git a/library/think/Response.php b/library/think/Response.php index 634a2d99..8c35f87b 100644 --- a/library/think/Response.php +++ b/library/think/Response.php @@ -111,7 +111,12 @@ class Response header($name . ':' . $val); } } - echo $data; + if (is_scalar($data)) { + echo $data; + } else { + throw new Exception('不支持的数据类型输出:' . gettype($data)); + } + if (function_exists('fastcgi_finish_request')) { // 提高页面响应 fastcgi_finish_request();