歡迎您光臨本站 註冊首頁

PHP菜鳥有問題向各路高手提問

←手機掃碼閱讀     火星人 @ 2014-03-04 , reply:0

PHP菜鳥有問題向各路高手提問

我第一次用PHP。。還很菜。。。希望有高手指點,下面的哪裡不對啊。。按照書上打的。可是沒有成功。。總是Parse error: parse error, unexpected '{' in D:\usr\local\www\data\guess.php on line 9     謝謝指點。。


<?php
     session_start();
     if(isset($_request['input'])&& isset($_session['number']))
        

    {
        $flag=false;
        if(is_numeric($_request('input'))
    {
        arry_push($_session['process'],$_request['input']));
        if($_request('input')=$_session['number'])
    {
        $flag=ture;
    }
    }
       $max=count($_session['process']
        for($i=0;$i<$max;$++)
    {
    {
       $input_number=$_session['process'][$i];
       $step=$i+1;
       if($input_number=$_session['number'])
    {
   echo"第step次,$input_number猜對了<br/>";
    }
     elseif($input_number>$_session['number'])
    {
    echo "第step次,$input_number猜大了<br/>";
    }
    else
    {
       echo "第step次,$input_number猜小了<br/>";
    }
    {
       if($flag) {echo "猜對了,你用了$max 次<br/><a  href=guess.php>I want play again</a>";
        $_session =null;
       exit;
    }
     else if($max>=8)   
    {
          echo "你猜了$max次,但是沒有猜對,我想的是{$_session['number'].<br?><ahref=guess.php>我要再來一次</a>",
        $_session =null;
         exit;
    }
        elseif(is_numeric($_request['input'])
    {
       echo "請輸入0-100內的整數";}
    }
    }
      else
    {
       $number=rangd(1,100);
       $_session['number']=$number;
       $_session['process']=arry();
       echo 猜數:我已經想好了,你可以開始猜了(0-100內的整數),猜大猜小我會提示你,只有八次機會喔。<br/>";
    }
     ?>
       <form action="guess.php"method="post">
       <input type="test"name="input"value="">
       <input type="submit"name="submit"value="我猜">
       </form>
《解決方案》

仔細檢查花括弧,沒有配對

[火星人 ] PHP菜鳥有問題向各路高手提問已經有664次圍觀

http://coctec.com/docs/service/show-post-37730.html