本文整理匯總了PHP中pocketmine\utils\MainLogger::critical方法的典型用法代碼示例。如果您正苦於以下問題:PHP MainLogger::critical方法的具體用法?PHP MainLogger::critical怎麽用?PHP MainLogger::critical使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類pocketmine\utils\MainLogger
的用法示例。
在下文中一共展示了MainLogger::critical方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: foreach
foreach ($args as $name => $value) {
$params .= (\is_object($value) ? \get_class($value) . " " . (\method_exists($value, "__toString") ? $value->__toString() : "object") : \gettype($value) . " " . (\is_array($value) ? "Array()" : Utils::printable(@\strval($value)))) . ", ";
}
}
$messages[] = "#{$j} " . (isset($trace[$i]["file"]) ? cleanPath($trace[$i]["file"]) : "") . "(" . (isset($trace[$i]["line"]) ? $trace[$i]["line"] : "") . "): " . (isset($trace[$i]["class"]) ? $trace[$i]["class"] . (($trace[$i]["type"] === "dynamic" or $trace[$i]["type"] === "->") ? "->" : "::") : "") . $trace[$i]["function"] . "(" . Utils::printable(\substr($params, 0, -2)) . ")";
}
return $messages;
}
function cleanPath($path)
{
return \rtrim(\str_replace(["\\", ".php", "phar://", \rtrim(\str_replace(["\\", "phar://"], ["/", ""], \pocketmine\PATH), "/"), \rtrim(\str_replace(["\\", "phar://"], ["/", ""], \pocketmine\PLUGIN_PATH), "/")], ["/", "", "", "", ""], $path), "/");
}
\set_error_handler([\ExceptionHandler::class, "handler"], -1);
$errors = 0;
if (\version_compare("5.6.0", PHP_VERSION) > 0) {
$logger->critical("You must use PHP >= 5.6");
++$errors;
}
if (\php_sapi_name() !== "cli") {
$logger->critical("You must run PocketMine-MP using the CLI.");
++$errors;
}
if (!\extension_loaded("sockets")) {
$logger->critical("Unable to find the Socket extension.");
++$errors;
}
$pthreads_version = \phpversion("pthreads");
if (\substr_count($pthreads_version, ".") < 2) {
$pthreads_version = "0.{$pthreads_version}";
}
if (\version_compare($pthreads_version, "2.0.9") < 0) {
示例2: foreach
}
foreach ($args as $name => $value) {
$params .= (is_object($value) ? get_class($value) . " " . (method_exists($value, "__toString") ? $value->__toString() : "object") : gettype($value) . " " . (is_array($value) ? "Array()" : Utils::printable(@strval($value)))) . ", ";
}
}
$messages[] = "#{$j} " . (isset($trace[$i]["file"]) ? cleanPath($trace[$i]["file"]) : "") . "(" . (isset($trace[$i]["line"]) ? $trace[$i]["line"] : "") . "): " . (isset($trace[$i]["class"]) ? $trace[$i]["class"] . (($trace[$i]["type"] === "dynamic" or $trace[$i]["type"] === "->") ? "->" : "::") : "") . $trace[$i]["function"] . "(" . Utils::printable(substr($params, 0, -2)) . ")";
}
return $messages;
}
function cleanPath($path)
{
return rtrim(str_replace(["\\", ".php", "phar://", rtrim(str_replace(["\\", "phar://"], ["/", ""], \pocketmine\PATH), "/"), rtrim(str_replace(["\\", "phar://"], ["/", ""], \pocketmine\PLUGIN_PATH), "/")], ["/", "", "", "", ""], $path), "/");
}
$errors = 0;
if (php_sapi_name() !== "cli") {
$logger->critical("You must run ImagicalMine using the CLI.");
++$errors;
}
if (!extension_loaded("sockets")) {
$logger->critical("Unable to find the Socket extension.");
++$errors;
}
$pthreads_version = phpversion("pthreads");
if (substr_count($pthreads_version, ".") < 2) {
$pthreads_version = "0.{$pthreads_version}";
}
if (version_compare($pthreads_version, "3.1.5") < 0) {
$logger->critical("pthreads >= 3.1.5 is required, while you have {$pthreads_version}.");
++$errors;
}
if (!extension_loaded("uopz")) {