阅读(4752) (0)

set_content_type()

2017-06-22 14:36:12 更新

作用:设置文档类型及编码。 语法: null set_content_type(string $type[, string $charset])

参数:

  • $type 文档类型。
  • $charset 编码,默认值 UTF-8。 说明: 在未发送头部信息的情况下,函数会将文档类型和编码设置在响应头部中,如果头部信息已发送,则将其设置在 HTML 代码中。

示例:

<?php
set_content_type('text/html');
?>

或者:

<head>
<?php set_content_type('text/html', 'GB2312'); ?>
</head>