$value) { $content[$key] = addslashes(trim($value)); if (preg_match($pattern, $content[$key])) { // echo $content[$key]; $content[$key] = ''; } } } else { $content = addslashes(trim($content)); if (preg_match($pattern, $content)) { $content = ''; } } return $content; } /** * json 格式输出对象 */ function print_json($data) { $res = json_encode($data, JSON_PRETTY_PRINT); if (IS_CLI) { echo $res; } else { // 替换空格和换行符 $res = str_replace(' ', ' ', $res); $res = str_replace("\n", '
', $res); echo $res; } }