Catch The Exception
<?php
try {
$tt = new TokyoTyrant("192.168.1.100", 11211);
}catch (TokyoTyrantException $e) {
var_dump($e);
exit;
}
?>
PHP - Manual: TokyoTyrant::__construct
2024-12-23
(PECL tokyo_tyrant >= 0.1.0)
TokyoTyrant::__construct — Construct a new TokyoTyrant object
$host
[, int $port
= TokyoTyrant::RDBDEF_PORT
[, array $options
]]] )Constructs a new TokyoTyrant object and optionally connects to the database
host
The hostname. Default: NULL
port
port number. Default: 1978
options
Connection options: timeout (default: 5.0), reconnect (default: TRUE
) and persistent (default: TRUE
)
Throws TokyoTyrantException if connection to database fails
Catch The Exception
<?php
try {
$tt = new TokyoTyrant("192.168.1.100", 11211);
}catch (TokyoTyrantException $e) {
var_dump($e);
exit;
}
?>
官方地址:https://www.php.net/manual/en/tokyotyrant.construct.php