PHP解析错误:语法错误,意外';其他';(T_ELSE)在

PHP解析错误:语法错误,意外';其他';(T_ELSE)在,php,Php,我的结果页面上有php代码,我在php脚本中添加了一些其他代码,但在/122行中出现了错误php Parse erro syntax error,意外的else T_else $domain_only = preg_split('/\./', $domain); foreach($ext as $item){ $domain = $domain_only[0].$item; if ( checkdnsrr($domain, 'ANY') ) { $resp

我的结果页面上有php代码,我在php脚本中添加了一些其他代码,但在/122行中出现了错误php Parse erro syntax error,意外的else T_else

$domain_only = preg_split('/\./', $domain);

foreach($ext as $item){

    $domain = $domain_only[0].$item;

    if ( checkdnsrr($domain, 'ANY') ) {

        $response = '<tr id="com">
            <td>
                <i class="fa fa-times text-color-error"></i>
            </td>
            <td>
                <h4 class="text-color-error">'.$domain.'</h4>
            </td>
            <td class="text-color-error">Rp. 125.000</td>
            <td>
                <a class="button button-primary" href="https://www.indoip.com/whois/'.$domain.'" target="_blank" style="background: #cd3100">
                <i class="fa fa-eye icon-left"></i>Whois</a>
            </td>
        </tr>';
        }
line 122     else
        {
            //  =================================================
        $response = '<tr id="web.id">
            <td>
                <i class="fa fa-check text-color-success"></i>
            </td>
            <td>
                <h4>'.$domain.'</h4>
            </td>
            <td class="highlight">Rp. 55.000</td>
            <td>
            </td>
        </tr>';
    }
     else
        {
            //  =================================================
        $response = '<tr id="net">
            <td>
                <i class="fa fa-check text-color-success"></i>
            </td>
            <td>
                <h4>'.$domain.'</h4>
            </td>
            <td class="highlight">Rp. 93.000</td>
            <td>
            </td>
        </tr>';
    }
     else
        {
            //  =================================================
        $response = '<tr id="co.id">
            <td>
                <i class="fa fa-check text-color-success"></i>
            </td>
            <td>
                <h4>'.$domain.'</h4>
            </td>
            <td class="highlight">Rp. 80.000</td>
            <td>
            </td>
        </tr>';
    }
     else
        {
            //  =================================================
        $response = '<tr id="net.id">
            <td>
                <i class="fa fa-check text-color-success"></i>
            </td>
            <td>
                <h4>'.$domain.'</h4>
            </td>
            <td class="highlight">Rp. 65.000</td>
            <td>
            </td>
        </tr>';
    }




    echo $response;
    $i++;
}
?>
$domain\u only=preg\u split('/\./',$domain);
foreach($ext作为$item){
$domain=$domain\u only[0]。$item;
if(checkdnsrr($domain,'ANY')){
$response='1
“.$domain”
125.000卢比
';
}
第122行其他
{
//  =================================================
$response='1
“.$domain”
55.000卢比
';
}
其他的
{
//  =================================================
$response='1
“.$domain”
93.000卢比
';
}
其他的
{
//  =================================================
$response='1
“.$domain”
80.000卢比
';
}
其他的
{
//  =================================================
$response='1
“.$domain”
65.000卢比
';
}
回音$应答;
$i++;
}
?>
如果你只使用2,脚本运行平稳,但如果我添加了一个类似上面的错误

如何解决此错误,上面的代码中是否缺少代码


非常感谢您的帮助

我的朋友,您不能使用其他多种方法。如果其他情况类似,则应使用嵌套:

if ( checkdnsrr($domain, 'ANY')) {
} else if ( checkdnsrr($domain, 'secondValue')) { // You are missing this part and not adding if condition
} else if (checkdnsrr($domain, 'thirdValue')) { // You are missing this part and not adding if condition
} else if (checkdnsrr($domain, 'fourthValue')) { // You are missing this part and not adding if condition
} else {
}
您可以在以下链接中查看:


在这里,您需要检查您的要求,并需要使您的条件显示不同的价格。我不能确定你的要求,所以我不能为你提出具体条件。希望它能对您有所帮助。

您可以使用一个
else
和一个
if
语句。如果您想要更多的
else
,则必须使用
else If


我是否应该在其他所有兄弟中添加if?像其他的,如果{?@JNweb是的,从技术上讲,由于PHP lexer的一些小增强,您希望使用而不是分开使用。是的@JNweb.else语句在没有条件匹配时执行。在您当前的代码中,您有4个else条件,其中只有一个可以执行,其他3个永远不会执行。这是一个错误。因此,您应该在前三个else条件中添加if条件先生,对不起,你能提供我上面代码的例子吗?我已经更新了我的答案。但是你需要弄清楚你的其他条件。