数据从数据库检索
while($row_posts = mysql_fetch_array($run_posts))
{
$post_id1=$row_posts['userID'];
$post_title=$row_posts['torrent_hash'];
使用传输软件检查哈希值
try{
$transmission = new Transmission\Transmission();
$torrent = $transmission->get($post_title);
$torrent->getName();
}
catch (Exception $e) {
echo 'Caught exception: ', $e->getMessage(), "\n";
}
如果在传输中找不到哈希ID,则显示如下所示的错误
Caught exception: Torrent with ID 58bd21a7938cb1d65f737bcb6031111816d924d9 not found
Notice: Undefined variable: torrent in C:\xampp\htdocs\final\info.php on line 46
Fatal error: Call to a member function isFinished() on a non-object in C:\xampp\htdocs\final\info.php on line 46
我需要输出类似如果发生运行时异常,那么只是打破第一个循环并从数据库执行第二个值是可能的吗?
答案 0 :(得分:1)