Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/228.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 分析错误:语法错误,意外';其他';(T_ELSE)第10行_Php_If Statement - Fatal编程技术网

Php 分析错误:语法错误,意外';其他';(T_ELSE)第10行

Php 分析错误:语法错误,意外';其他';(T_ELSE)第10行,php,if-statement,Php,If Statement,有人能给我一些关于如何处理这个错误的指导吗?我不是程序员,所以对这类事情几乎没有技能/知识。但是,我渴望学习,如果有人能给我一些指导,我将非常感激 Parse error: syntax error, unexpected 'else' (T_ELSE) on line 10 与此相关的代码如下所示: <?php include 'desciptions.php'; include 'title.php'; $rand=rand(0,67); else if($rand=='1

有人能给我一些关于如何处理这个错误的指导吗?我不是程序员,所以对这类事情几乎没有技能/知识。但是,我渴望学习,如果有人能给我一些指导,我将非常感激

Parse error: syntax error, unexpected 'else' (T_ELSE) on line 10
与此相关的代码如下所示:

<?php 


include 'desciptions.php';
include 'title.php';
$rand=rand(0,67);


else if($rand=='1')
    $desciptions=$d1;
    $title=$m1;

else if($rand=='2')
    $desciptions=$d2;
    $title=$m2;

else if($rand=='0')
    $desciptions=$d0;
        $title=$m0;
?>

将代码更改为:

<?php

include 'desciptions.php';
include 'title.php';
$rand = rand(0, 67);


if ($rand == '1') {
    $desciptions = $d1;
    $title = $m1;
} elseif ($rand == '2') {
    $desciptions = $d2;
    $title = $m2;
} elseif ($rand == '0') {
    $desciptions = $d0;
    $title = $m0;
}
?>

删除第一个
else
,添加
{
}
并删除记号:

<?php 

include 'desciptions.php';
include 'title.php';
$rand=rand(0,67);

if($rand == 1) {
    $desciptions = $d1;
    $title = $m1;
} else if($rand == 2) {
    $desciptions = $d2;
    $title = $m2;
} else if($rand == 0) {
    $desciptions = $d0;
    $title = $m0;
}
?>


也可以将
descriptions
修复为
descriptions

解析错误:语法错误,在/index.php的第11行中出现意外的“$title”(T_变量),您应该从教程开始了解其基本语法错误查看您的逻辑,这可以在一行中完成。另外,请获取PHP基础知识教程。正确的基础是强制性的,你应该通过检查手册开始:谢谢你的Bro正在工作,很高兴它工作。进一步阅读: