jia_xue 2017-07-23 08:07 采纳率: 0%
浏览 1100
已结题

PHP的代码运行出现的错误,不知道原因

 <?php
$str  = <<<EOD
 Example of string
spanning multiple lines
using heredoc syntax.
 EOD;

 /* 含有变量的更复杂示例 */
 class  foo
 {
    var  $foo ;
    var  $bar ;

    function  foo ()
    {
         $this -> foo  =  'Foo' ;
         $this -> bar  = array( 'Bar1' ,  'Bar2' ,  'Bar3' );
    }
}

 $foo  = new  foo ();
 $name  =  'MyName' ;

echo <<<EOT
 My name is " $name ". I am printing some  $foo -> foo .
Now, I am printing some  { $foo -> bar [ 1 ]} .
This should print a capital 'A': \x41
 EOT;
 ?> 


这个代码提示( ! ) Parse error: syntax error, unexpected $end in D:\wamp_code\test.php on line 29,也就是最后的"?>"错误,什么原因,大神
  • 写回答

2条回答 默认 最新

  • 猪崽儿 2017-07-23 08:48
    关注

    $this -> foo = 'Foo' ;
    $this -> bar = array( 'Bar1' , 'Bar2' , 'Bar3' )

    少了个分号

    评论

报告相同问题?