1.header

PHP文件插入header("Content-type: text/html; charset=utf-8");
相当于页面里面的<meta http-equiv="Content-Type" content="text/html; charset=utf-8">;
目的:防止页面出现乱码

2.error_reporting

定义和用法:error_reporting()设置PHP的报错级别并返回当前级别。
函数语法:error_reporting(report_level)
如果参数 level 未指定,当前报错级别将被返回。下面几项是level可能的值:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
1:E_ERROR 致命的运行错误。错误无法恢复,暂停执行脚本。
2:E_WARNING 运行时警告(非致命性错误)。非致命的运行错误,脚本执行不会停止。
4:E_PARSE 编译时解析错误。解析错误只由分析器产生。
8:E_NOTICE 运行时提醒(这些经常是你代码中的bug引起的,也可能是有意的行为造成的。)
16:E_CORE_ERROR PHP启动时初始化过程中的致命错误。
32:E_CORE_WARNING PHP启动时初始化过程中的警告(非致命性错)。
64:E_COMPILE_ERROR 编译时致命性错。这就像由Zend脚本引擎生成了一个E_ERROR。
128:E_COMPILE_WARNING 编译时警告(非致命性错)。这就像由Zend脚本引擎生成了一个E_WARNING警告。
256:E_USER_ERROR 用户自定义的错误消息。这就像由使用PHP函数trigger_error(程序员设置E_ERROR)
512:E_USER_WARNING 用户自定义的警告消息。这就像由使用PHP函数trigger_error(程序员设定的一个E_WARNING警告)
1024:E_USER_NOTICE 用户自定义的提醒消息。这就像一个由使用PHP函数trigger_error(程序员一个E_NOTICE集)
2048:E_STRICT 编码标准化警告。允许PHP建议如何修改代码以确保最佳的互操作性向前兼容性。
4096:E_RECOVERABLE_ERROR 开捕致命错误。这就像一个E_ERROR,但可以通过用户定义的处理捕获(又见set_error_handler())
8191:E_ALL 所有的错误和警告(不包括 E_STRICT) (E_STRICT will be part of E_ALL as of PHP 6.0)

任意数目的以上选项都可以用“或”来连接(用 OR 或 |),这样可以报告所有需要的各级别错误。
例如,下面的代码关闭了用户自定义的错误和警告,执行了某些操作,然后恢复到原始的报错级别:

 <?php
//禁用错误报告
error_reporting(0);
//报告运行时错误
error_reporting(E_ERROR | E_WARNING | E_PARSE);
//报告所有错误
error_reporting(E_ALL);
?>

PHP中header('content-type:text/html;charset="utf-8')和error_reporting()的作用的更多相关文章

  1. {"timestamp":"2019-11-12T02:39:28.949+0000","status":415,"error":"Unsupported Media Type","message":"Content type 'text/plain;charset=UTF-8' not supported","path":&quo

    在Jmeter运行http请求时报错: {"timestamp":"2019-11-12T02:39:28.949+0000","status&quo ...

  2. 遇到问题之“postman报Unsupported Media Type: Content type 'text/plain;charset=UTF-8' not supported”

    postman报Unsupported Media Type: Content type 'text/plain;charset=UTF-8' not supported postman之所以报Uns ...

  3. Jmeter发送post请求报错Content type 'application/x-www-form-urlencoded;charset=UTF-8' not supported

    常识普及: Content-type,在Request Headers里面,告诉服务器,我们发送的请求信息格式,在JMeter中,信息头存储在信息头管理器中,所以在做接口测试的时候,我们维护Conte ...

  4. org.springframework.web.HttpMediaTypeNotSupportedException: Content type 'application/json;charset=UTF-8' not supported

    最后找到我的问题,springmvc配置文件中没加 <mvc:annotation-driven/> java代码: @RequestMapping(value="/reques ...

  5. 接入WxPusher微信推送服务出现错误:Content type 'application/x-www-form-urlencoded;charset=UTF-8' not supported

    背景 使用WxPusher微信推送服务 ,可以及时的将服务的一些运行异常信息,发送到自己的微信上,方便了解服务的运行状态(PS:这个服务是免费的). 你可以在这里看到WxPusher微信推送服务的接入 ...

  6. Content type 'application/json;charset=UTF-8' not supported异常的解决过程

    首先说一下当时的场景,其实就是一个很简单的添加操作,后台传递的值是json格式的,如下图 ,后台对应的实体类, @Data @EqualsAndHashCode(callSuper = false) ...

  7. springboot 报错 Content type 'application/x-www-form-urlencoded;charset=UTF-8' not supported

    开始 controller 方法写的是 @RequestMapping( value = "/add", method = RequestMethod.POST ) public ...

  8. ajax使用向Spring MVC发送JSON数据出现 org.springframework.web.HttpMediaTypeNotSupportedException: Content type 'application/x-www-form-urlencoded;charset=UTF-8' not supported错误

    ajax使用向Spring MVC发送JSON数据时,后端Controller在接受JSON数据时报org.springframework.web.HttpMediaTypeNotSupportedE ...

  9. jmeter报"msg":"Content type 'application/x-www-form-urlencoded;charset=UTF-8' not supported"的解决方法

    1.报"msg":"Content type 'application/x-www-form-urlencoded;charset=UTF-8' not supporte ...

  10. Content type 'application/x-www-form-urlencoded;charset=UTF-8' not supported

    Content type 'application/x-www-form-urlencoded;charset=UTF-8' not supported告诉你,你的请求头是application/x- ...

随机推荐

  1. 【大数据系列】使用api修改hadoop的副本数和块大小

    package com.slp.hdfs; import org.apache.commons.io.output.ByteArrayOutputStream; import org.apache.h ...

  2. 给Repeater控件里添加序号的5种方法

    Repeater是我们经常用的一个显示数据集的数据控件,经常我们希望在数据前显示数据的序号,那么我们该怎么为Repeater控件添加序号呢?下面编辑为大家介绍几种常用的为Repeater控件添加序号的 ...

  3. Post Office Protocol --- pop协议

    https://en.wikipedia.org/wiki/Simple_Mail_Transfer_Protocol

  4. LeetCode 79 Word Search(单词查找)

    题目链接:https://leetcode.com/problems/word-search/#/description 给出一个二维字符表,并给出一个String类型的单词,查找该单词是否出现在该二 ...

  5. Scrapy计划表

    第一步 Scrapy 一览:理解Scrapy是什么,他能帮到你什么 安装指南:在电脑上安装Scrapy Scrapy 教程:编写第一个Scrapy项目 示例:通过前人写好的Scrapy项目进行学习 基 ...

  6. maven 使用-P指定环境打包,linux移动配置文件失败,windows成功!

    问题描述:    windows机器使用-P指定环境打包,最后组装文件组装成功,配置文件成功移动,linux下却只移动了jar包. windows:                  linux:   ...

  7. ASP.NET MVC 使用Redis共享Session

    储存模式 1.InProc模式 这是ASP.NET默认的Session管理模式,在应用进程内维护Session. 2.StateServer模式 这是在服务器装了.NET环境后自带的一个StateSe ...

  8. iOS - View的抖动效果

    /** * 抖动效果 * * @param view 要抖动的view */ - (void)shakeAnimationForView:(UIView *) view { CALayer *view ...

  9. thinkCMF----导航高亮显示

    导航高亮显示,有多种方法,这里给出一个简单的表示下: <a href="__ROOT__"> <span class="text db"> ...

  10. Visual Studio启用64位 IIS Express 解决 x64位的dll 而出现 未能加载文件或程序集“xxxxxxxx”或它的某一个依赖项。试图加载格式不正确的程序。