本文整理汇总了PHP中error_reporting函数的典型用法代码示例。如果您正苦于以下问题:PHP error_reporting函数的具体用法?PHP error_reporting怎么用?PHP error_reporting使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了error_reporting函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: prepareEnvironment
/**
* @ignore
* @param array $options
*/
public function prepareEnvironment($options = array())
{
if (empty($options['skipErrorHandler'])) {
set_error_handler(array('Ip\\Internal\\ErrorHandler', 'ipErrorHandler'));
}
if (empty($options['skipError'])) {
if (ipConfig()->showErrors()) {
error_reporting(E_ALL | E_STRICT);
ini_set('display_errors', '1');
} else {
ini_set('display_errors', '0');
}
}
if (empty($options['skipSession'])) {
if (session_id() == '' && !headers_sent()) {
//if session hasn't been started yet
session_name(ipConfig()->get('sessionName'));
if (!ipConfig()->get('disableHttpOnlySetting')) {
ini_set('session.cookie_httponly', 1);
}
session_start();
}
}
if (empty($options['skipEncoding'])) {
mb_internal_encoding(ipConfig()->get('charset'));
}
if (empty($options['skipTimezone'])) {
date_default_timezone_set(ipConfig()->get('timezone'));
//PHP 5 requires timezone to be set.
}
}
示例2: autoload_framework_classes
/**
* Function used to auto load the framework classes
*
* It imlements PSR-0 and PSR-4 autoloading standards
* The required class name should be prefixed with a namespace
* This lowercaser of the namespace should match the folder name of the class
*
* @since 1.0.0
* @param string $class_name name of the class that needs to be included
*/
function autoload_framework_classes($class_name)
{
error_reporting(E_ALL);
ini_set('display_errors', true);
ini_set('display_startup_errors', true);
/** If the required class is in the global namespace then no need to autoload the class */
if (strpos($class_name, "\\") === false) {
return false;
}
/** The namespace seperator is replaced with directory seperator */
$class_name = str_replace("\\", DIRECTORY_SEPARATOR, $class_name);
/** The class name is split into namespace and short class name */
$path_info = explode(DIRECTORY_SEPARATOR, $class_name);
/** The namepsace is extracted */
$namespace = implode(DIRECTORY_SEPARATOR, array_slice($path_info, 0, count($path_info) - 1));
/** The class name is extracted */
$class_name = $path_info[count($path_info) - 1];
/** The namespace is converted to lower case */
$namespace_folder = trim(strtolower($namespace), DIRECTORY_SEPARATOR);
/** .php is added to class name */
$class_name = $class_name . ".php";
/** The applications folder name */
$framework_folder_path = realpath(dirname(__FILE__));
/** The application folder is checked for file name */
$file_name = $framework_folder_path . DIRECTORY_SEPARATOR . $namespace_folder . DIRECTORY_SEPARATOR . $class_name;
if (is_file($file_name)) {
include_once $file_name;
}
}
示例3: _initError
public function _initError()
{
if ($this->config->application->showErrors) {
error_reporting(-1);
ini_set('display_errors', 'On');
}
}
示例4: errorHandler
function errorHandler($errno, $errstr, $errfile, $errline)
{
if (!(error_reporting() & $errno)) {
// This error code is not included in error_reporting
return;
}
function senderror($error)
{
$session = $_SESSION;
unset($session['pass']);
$m = array2str(array('errormsg' => $error, 'session' => array2str($session, " %s = '%s'"), 'server' => array2str($_SERVER, " %s = '%s'"), 'request' => array2str($_REQUEST, " %s = '%s'")));
sendgmail(array('tony.jiang@yale.edu', 'qingyang.chen@gmail.com'), "info@sublite.net", 'SubLite Error Report', $m);
//echo "Error report sent!<br />\n";
}
switch ($errno) {
case E_USER_ERROR:
$error = "<b>My ERROR</b> [{$errno}] {$errstr}<br />\n\n Fatal error on line {$errline} in file {$errfile}\n , PHP " . PHP_VERSION . " (" . PHP_OS . ")<br />\n";
echo $error;
senderror($error);
echo 'Aborting...<br />\\n';
exit(1);
break;
default:
$error = "Unknown error type: [{$errno}] \"{$errstr}\" in file \"{$errfile}\" on line {$errline}<br />\n";
Controller::render('500');
Controller::finish();
senderror($error);
//echo 'Aborting...<br />\n';
exit(1);
break;
}
/* Don't execute PHP internal error handler */
return true;
}
示例5: _setupEnvironment
protected function _setupEnvironment()
{
parent::_setupEnvironment();
// disable strict reporting
error_reporting(E_ALL);
return $this;
}
示例6: error_handler
function error_handler($errno, $errstr, $errfile, $errline)
{
global $log, $config;
// error suppressed with @
if (error_reporting() === 0) {
return false;
}
switch ($errno) {
case E_NOTICE:
case E_USER_NOTICE:
$error = 'Notice';
break;
case E_WARNING:
case E_USER_WARNING:
$error = 'Warning';
break;
case E_ERROR:
case E_USER_ERROR:
$error = 'Fatal Error';
break;
default:
$error = 'Unknown';
break;
}
if ($config->get('config_error_display')) {
echo '<b>' . $error . '</b>: ' . $errstr . ' in <b>' . $errfile . '</b> on line <b>' . $errline . '</b>';
}
if ($config->get('config_error_log')) {
$log->write('PHP ' . $error . ': ' . $errstr . ' in ' . $errfile . ' on line ' . $errline);
}
return true;
}
示例7: _init_env
private function _init_env()
{
error_reporting(E_ERROR);
define('MAGIC_QUOTES_GPC', function_exists('get_magic_quotes_gpc') && get_magic_quotes_gpc());
// ' " \ NULL 等字符转义 当magic_quotes_gpc=On的时候,函数get_magic_quotes_gpc()就会返回1
define('GZIP', function_exists('ob_gzhandler'));
// ob 缓存压缩输出
if (function_exists('date_default_timezone_set')) {
@date_default_timezone_set('Etc/GMT-8');
//东八区 北京时间
}
define('TIMESTAMP', time());
if (!defined('BLOG_FUNCTION') && !@(include BLOG_ROOT . '/source/functions.php')) {
exit('functions.php is missing');
}
define('IS_ROBOT', checkrobot());
global $_B;
$_B = array('uid' => 0, 'username' => '', 'groupid' => 0, 'timestamp' => TIMESTAMP, 'clientip' => $this->_get_client_ip(), 'mobile' => '', 'agent' => '', 'admin' => 0);
checkmobile();
$_B['PHP_SELF'] = bhtmlspecialchars($this->_get_script_url());
$_B['basefilename'] = basename($_B['PHP_SELF']);
$sitepath = substr($_B['PHP_SELF'], 0, strrpos($_B['PHP_SELF'], '/'));
$_B['siteurl'] = bhtmlspecialchars('http://' . $_SERVER['HTTP_HOST'] . $sitepath . '/');
getReferer();
$url = parse_url($_B['siteurl']);
$_B['siteroot'] = isset($url['path']) ? $url['path'] : '';
$_B['siteport'] = empty($_SERVER['SERVER_PORT']) || $_SERVER['SERVER_PORT'] == '80' ? '' : ':' . $_SERVER['SERVER_PORT'];
$this->b =& $_B;
}
示例8: send_request_via_fsockopen1
function send_request_via_fsockopen1($host, $path, $content)
{
$posturl = "ssl://" . $host;
$header = "Host: {$host}\r\n";
$header .= "User-Agent: PHP Script\r\n";
$header .= "Content-Type: text/xml\r\n";
$header .= "Content-Length: " . strlen($content) . "\r\n";
$header .= "Connection: close\r\n\r\n";
$fp = fsockopen($posturl, 443, $errno, $errstr, 30);
if (!$fp) {
$response = false;
} else {
error_reporting(E_ERROR);
fputs($fp, "POST {$path} HTTP/1.1\r\n");
fputs($fp, $header . $content);
fwrite($fp, $out);
$response = "";
while (!feof($fp)) {
$response = $response . fgets($fp, 128);
}
fclose($fp);
error_reporting(E_ALL ^ E_NOTICE);
}
return $response;
}
示例9: __construct
/**
* เรียกใช้งาน Class แบบสามารถเรียกได้ครั้งเดียวเท่านั้น
*
* @param array $config ค่ากำหนดของ แอพพลิเคชั่น
* @return Singleton
*/
public function __construct()
{
/* display error */
if (defined('DEBUG') && DEBUG === true) {
/* ขณะออกแบบ แสดง error และ warning ของ PHP */
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(-1);
} else {
/* ขณะใช้งานจริง */
error_reporting(E_ALL & ~E_NOTICE & ~E_STRICT);
}
/* config */
self::$cfg = \Config::create();
/* charset default UTF-8 */
ini_set('default_charset', self::$char_set);
if (extension_loaded('mbstring')) {
mb_internal_encoding(self::$char_set);
}
/* inint Input */
Input::normalizeRequest();
// template ที่กำลังใช้งานอยู่
Template::inint(Input::get($_GET, 'skin', self::$cfg->skin));
/* time zone default Thailand */
@date_default_timezone_set(self::$cfg->timezone);
}
示例10: update
public function update($d)
{
error_reporting(error_reporting() & ~E_NOTICE);
//supressing notice message
$query = $this->db->query("\n\t\t\tREPLACE INTO wog_player\n\t\t\t(p_id, p_name, p_password, p_email, p_ipadd, p_act_time, act_num,\n\t\t\tact_num_time, p_lock_time, p_st, p_userlv, p_lock, p_npc, s_property,\n\t\t\thp, hpmax, sp, spmax, ch_id, p_money, p_bank, p_cash, str, smart, \n\t\t\tagi, life, vit, au, be, base_str, base_smart, base_agi, base_life,\n\t\t\tbase_vit, base_au, base_be, at, df, mat, mdf, p_exp, p_nextexp, \n\t\t\tp_lv, p_birth, p_place, p_sat_name, p_win, p_lost, p_sex, p_img_set, \n\t\t\tp_img_url, p_pk_s, p_pk_money, p_bag, p_depot, p_cp_st, p_cp_time, \n\t\t\ti_img, p_g_id, t_id, p_support, p_recomm, p_attempts, p_cdate,\n\t\t\tp_online_time, p_bbsid)\n\t\t\tVALUES\n\t\t\t('{$d['p_id']}', '{$d['p_name']}', '{$d['p_password']}', '{$d['p_email']}', '{$d['p_ipadd']}', '{$d['p_act_time']}', '{$d['act_num']}', \n\t\t\t'{$d['act_num_time']}', '{$d['p_lock_time']}', '{$d['p_st']}', '{$d['p_userlv']}', '{$d['p_lock']}', '{$d['p_npc']}', '{$d['s_property']}',\n\t\t\t'{$d['hp']}', '{$d['hpmax']}', '{$d['sp']}', '{$d['spmax']}', '{$d['ch_id']}', '{$d['p_money']}', '{$d['p_bank']}', '{$d['p_cash']}', '{$d['str']}', '{$d['smart']}', \n\t\t\t'{$d['agi']}', '{$d['life']}', '{$d['vit']}', '{$d['au']}', '{$d['be']}', '{$d['base_str']}', '{$d['base_smart']}', '{$d['base_agi']}', '{$d['base_life']}',\n\t\t\t'{$d['base_vit']}', '{$d['base_au']}', '{$d['base_be']}', '{$d['at']}', '{$d['df']}', '{$d['mat']}', '{$d['mdf']}', '{$d['p_exp']}', '{$d['p_nextexp']}', \n\t\t\t'{$d['p_lv']}', '{$d['p_birth']}', '{$d['p_place']}', '{$d['p_sat_name']}', '{$d['p_win']}', '{$d['p_lost']}', '{$d['p_sex']}', '{$d['p_img_set']}', \n\t\t\t'{$d['p_img_url']}', '{$d['p_pk_s']}', '{$d['p_pk_money']}', '{$d['p_bag']}', '{$d['p_depot']}', '{$d['p_cp_st']}', '{$d['p_cp_time']}', \n\t\t\t'{$d['i_img']}', '{$d['p_g_id']}', '{$d['t_id']}', '{$d['p_support']}', '{$d['p_recomm']}', '{$d['p_attempts']}', '{$d['p_cdate']}',\n\t\t\t'{$d['p_online_time']}', '{$d['p_bbsid']}')\n\t\t");
error_reporting(error_reporting() & E_NOTICE);
}
示例11: setUp
function setUp()
{
error_reporting(E_ALL & ~E_NOTICE);
$logger['push_callback'] = array(&$this, '_pushCallback');
// don't die when an exception is thrown
$this->progress = new HTML_Progress($logger);
}
示例12: handler
public function handler($errno, $errstr, $errfile, $errline)
{
if (error_reporting() === 0) {
return false;
}
throw new afPhpErrorException($this->intro . $errstr, $errfile, $errline);
}
示例13: ABSSAV
function ABSSAV()
{
$inFile = $_REQUEST['inFile'];
echo "Filename is: {$inFile}<br>";
require_once 'Excel/reader.php';
$data = new Spreadsheet_Excel_Reader();
$data->setOutputEncoding('CP1251');
$data->read($inFile);
error_reporting(E_ALL ^ E_NOTICE);
$Target_Database = 'binawan';
$Target_Table = $Target_Database . '.ruang';
$Target_KodeID = "BINAWAN";
$s = "TRUNCATE TABLE {$Target_Table}";
$r = _query($s);
for ($i = 2; $i <= $data->sheets[0]['numRows']; $i++) {
$w = array();
$w['RuangID'] = trim($data->sheets[0]['cells'][$i][2]);
$w['Nama'] = trim($data->sheets[0]['cells'][$i][3]);
$w['Kapasitas'] = trim($data->sheets[0]['cells'][$i][4]);
$w['KapasitasUjian'] = trim($data->sheets[0]['cells'][$i][4]);
$w['KolomUjian'] = trim($data->sheets[0]['cells'][$i][5]);
$w['KampusID'] = trim($data->sheets[0]['cells'][$i][6]);
$w['Lantai'] = trim($data->sheets[0]['cells'][$i][7]);
$w['RuangKuliah'] = trim($data->sheets[0]['cells'][$i][8]);
$s = "insert into {$Target_Table}\r\n (RuangID, Nama, Kapasitas, KapasitasUjian, KolomUjian, KampusID, Lantai, KodeID, RuangKuliah, UntukUSM\r\n\t )\r\n values\r\n ('{$w['RuangID']}', '{$w['Nama']}', '{$w['Kapasitas']}', '{$w['KapasitasUjian']}', '{$w['KolomUjian']}', '{$w['KampusID']}', '{$w['Lantai']}', 'BINAWAN', '{$w['RuangKuliah']}', '{$w['RuangKuliah']}'\r\n\t )";
$r = _query($s);
}
echo "<script>window.location = '?{$mnux}={$_SESSION['mnux']}'</script>";
}
示例14: handle_warning
/**
* 警告や E_USER_ERROR を捕捉した場合にエラー画面を表示させるエラーハンドラ関数.
*
* この関数は, set_error_handler() 関数に登録するための関数である.
* trigger_error にて E_USER_ERROR が生成されると, エラーログを出力した後,
* エラー画面を表示させる.
* E_WARNING, E_USER_WARNING が発生した場合、ログを記録して、true を返す。
* (エラー画面・エラー文言は表示させない。)
*
* @param integer $errno エラーコード
* @param string $errstr エラーメッセージ
* @param string $errfile エラーが発生したファイル名
* @param integer $errline エラーが発生した行番号
* @return void|boolean E_USER_ERROR が発生した場合は, エラーページへリダイレクト;
* E_WARNING, E_USER_WARNING が発生した場合、true を返す
*/
public static function handle_warning($errno, $errstr, $errfile, $errline)
{
// error_reporting 設定に含まれていないエラーコードは処理しない
if (!(error_reporting() & $errno)) {
return;
}
$error_type_name = GC_Utils_Ex::getErrorTypeName($errno);
switch ($errno) {
case E_USER_ERROR:
$message = "Fatal error({$error_type_name}): {$errstr} on [{$errfile}({$errline})]";
GC_Utils_Ex::gfPrintLog($message, ERROR_LOG_REALFILE, true);
SC_Helper_HandleError_Ex::displaySystemError($message);
exit(1);
break;
case E_WARNING:
case E_USER_WARNING:
case E_CORE_WARNING:
case E_COMPILE_WARNING:
$message = "Warning({$error_type_name}): {$errstr} on [{$errfile}({$errline})]";
GC_Utils_Ex::gfPrintLog($message, ERROR_LOG_REALFILE);
return true;
default:
break;
}
}
示例15: modifyRows
function modifyRows()
{
error_reporting(E_ALL + E_NOTICE);
$args = func_get_args();
$conn = array_shift($args);
$sql = array_shift($args);
if (!($query = $conn->prepare($sql))) {
//, $colTypes)) {
return false;
}
if (count($args)) {
// Just a quick hack to pass references in order to
// avoid errors.
foreach ($args as &$v) {
$v =& $v;
}
// Replace the bindParam function of the original
// abstraction layer.
call_user_func_array(array($query, 'bind_param'), $args);
//'bindParam'), $args);
}
if (!$query->execute()) {
$query->close();
return false;
}
$query->close();
//self::close_db_conn();
return true;
}