PHP致命错误:无法打破/继续 [英] PHP Fatal error: Cannot break/continue

查看:183
本文介绍了PHP致命错误:无法打破/继续的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果(isset($ errors))
{
foreach($ errors as $ error)
{
echo $ error;
$


else {break 2;}
//多一些代码

输出:

 致命错误:无法中断/继续2级

我试过 break 1 ,它也没有工作。 >

解决方案

  if(isset($ errors))
{
foreach $错误为$错误)
{
echo $ error;






$ b

没有必要像你想要的那样使用break结束于其他条件。只是使用上面的代码为您的错误,它将被跳过,如果没有错误。不需要休息


if (isset($errors))  
{  
foreach ($errors as $error)  
  {  
    echo $error;  
  }    
}  
else {break 2;}  
// some more code

Outputs:

Fatal error: Cannot break/continue 2 levels  

I tried break 1, it didn't work either.

解决方案

if (isset($errors))  
{  
foreach ($errors as $error)  
  {  
    echo $error;  
  }    
}  

No need to use break as you seem to want to end on the else condition. just use the above code for your errors, it will be skipped if no errors. No need for break

这篇关于PHP致命错误:无法打破/继续的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆