打破电流循环迭代,然后继续以PHP为单位



数据从数据库

检索
while($row_posts = mysql_fetch_array($run_posts))
    {
    $post_id1=$row_posts['userID'];
    $post_title=$row_posts['torrent_hash'];

使用传输软件检查哈希值

try{
    $transmission = new TransmissionTransmission();
    $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:xampphtdocsfinalinfo.php on line 46
Fatal error: Call to a member function isFinished() on a non-object in C:xampphtdocsfinalinfo.php on line 46

我需要输出,例如发生运行时异常,然后只需打破第一个循环并从数据库中执行第二个值吗?

在捕获块中尝试命令continue;

继续在循环结构中使用,以跳过当前环路的其余部分,并在条件评估下继续执行,然后在下一个迭代的开始。

请参阅PHP手册

相关内容

最新更新