如果和其他如果进度栏

时间:2014-11-09 18:43:24

标签: php int var-dump

以下是我尝试创建的简单进度条模块。

    <?php
$progress = 3;

if($progress = 2) {
echo "<pre>progress 2";
var_dump($progress);
echo "</pre><br>";
    $progressPrint = "
    <div class='one progressBar'></div>
    <div class='two progressBar'></div>
    ";echo $progressPrint;
}
elseif($progress = 3) {
echo "<pre>progress3";
var_dump($progress);
echo "</pre><br>";
    $progressPrint = "
    <div class='one progressBar'></div>
    <div class='two progressBar'></div>
    <div class='three progressBar'></div>
    ";echo $progressPrint;
}
elseif($progress = 4) {
    $progressPrint = "
    <div class='one progressBar progressBar'></div>
    <div class='two progressBar'></div>
    <div class='three progressBar'></div>
    <div class='four progressBar'></div>
    ";echo $progressPrint;
}
else {
    echo "nothing";
}

?>

设置测试的方式是手动输入$progress变量。从那里我对该整数进行测试。出于某种原因,我无法将其读取到$progressBar == 3 elseif

var转储表明,当变量显然是3时,我们会坚持2。

1 个答案:

答案 0 :(得分:1)

根据OP希望结束问题并标记为已解决:

您指定的所有if($progress =代替if($progress ==