很多朋友在编写PHP的时候,经常会遇到诸如下面这些错误的提示吧:
Warning: file_get_contents(/usr/local/tads/htdocs/XXXXXX/src/cache/countLoginnum.txt) [function.file-get-contents]: failed to open stream: No such file or directory in /usr/local/tads/htdocs/XXXXXXX/src/controllers/defaultController.php on line 43
Warning: Cannot modify header information - headers already sent by (output started at /usr/local/tads/htdocs/XXXXXX/src/config/env.php:5) in /usr/local/taesdk/1.0/phplib3/src/base/core/TMWebResponse.class.php on line 332
解决方法:就是在PHP文件头部直接加下屏蔽警告错误的代码:
PHP代码
01.<?php
02.//如有session_star(),放在session_star()后面
03.error_reporting(E_ERROR);
04.ini_set("display_errors","Off");
05.
06.//你的php代码
07.
08.?>