本文整理匯總了PHP中IO::writeError方法的典型用法代碼示例。如果您正苦於以下問題:PHP IO::writeError方法的具體用法?PHP IO::writeError怎麽用?PHP IO::writeError使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類IO
的用法示例。
在下文中一共展示了IO::writeError方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: elseif
}
$fileLine = "on line {$line} in ";
if (isset($_SERVER['DOCUMENT_ROOT'])) {
$fileLine .= File::relativePath($file, $_SERVER['DOCUMENT_ROOT']);
} elseif (isset($GLOBALS['argv'][0])) {
$fileLine .= File::relativePath($file, dirname($GLOBALS['argv'][0]));
} else {
$fileLine .= $file;
}
switch ($errno) {
case E_PARSE:
case E_USER_ERROR:
case E_ERROR:
break;
case E_NOTICE:
case E_USER_NOTICE:
if (PHP::isCLI()) {
IO::writeError("{$GLOBALS['argv'][0]}: WARNING: {$str} {$fileLine}\n");
} else {
error_log("WARNING: {$str} {$fileLine}");
}
return;
}
if (PHP::isCLI()) {
IO::writeError("{$GLOBALS['argv'][0]}: FATAL: {$str} {$fileLine}\n\t" . str_replace("\n", "\n\t", ABException::formatTrace(new Exception(), false, array('__errhandler'))) . "\n");
} else {
$s = ABException::formatTrace(new Exception(), true, array('__errhandler'));
error_log("FATAL: {$str} ({$fileLine}) {$s}");
print "<div class=\"err\"><b>FATAL:</b> {$str} <span class=\"file\">{$fileLine}</span>\n" . '<div class="trace">' . $s . '</div>' . '</div>';
}
exit(1);
示例2: printError
/**
* Print something to stderr
*
* @param mixed
* @return void
* @deprecated Use {@link IO::writeError()} instead
*/
public static function printError($str)
{
IO::writeError($str);
}