本文整理匯總了PHP中PEAR::isERROR方法的典型用法代碼示例。如果您正苦於以下問題:PHP PEAR::isERROR方法的具體用法?PHP PEAR::isERROR怎麽用?PHP PEAR::isERROR使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類PEAR
的用法示例。
在下文中一共展示了PEAR::isERROR方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: callback
function callback($id)
{
global $num_runs;
global $dsn_map;
$db_map = array();
$db_map[master] =& MDB2::connect($dsn_map[master]);
if (PEAR::isERROR($db_map[master])) {
die($db_map[master]->getMessage());
}
if (is_array($dsn_map[slave])) {
foreach ($dsn_map[slave] as $dsn_slave) {
$db_slave =& MDB2::connect($dsn_slave);
if (PEAR::isERROR($db_slave)) {
die($db_slave->getMessage());
}
$db_map[slave][] = $db_slave;
}
}
$cnt = 0;
$times = array();
// wait for the parent to HUP me
pcntl_signal(SIGHUP, create_function('', 'return 1;'));
sleep(600);
while ($cnt < $num_runs) {
$t0 = microtime(true);
do_task($db_map);
$t1 = microtime(true) - $t0;
$times[] = $t1;
$cnt++;
}
// cleanup
$db_map[master]->disconnect;
if (is_array($db_map[slave])) {
foreach ($db_map[slave] as $db_slave) {
$db_slave->disconnect;
}
}
$num = count($times);
$tot = array_sum($times);
$avg = $tot / $num;
$r = array($id, $num, min($times), max($times), $avg, $tot);
return $r;
}