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' )

    少了个分号

    评论

报告相同问题?

悬赏问题

  • ¥35 MIMO天线稀疏阵列排布问题
  • ¥60 用visual studio编写程序,利用间接平差求解水准网
  • ¥15 Llama如何调用shell或者Python
  • ¥20 谁能帮我挨个解读这个php语言编的代码什么意思?
  • ¥15 win10权限管理,限制普通用户使用删除功能
  • ¥15 minnio内存占用过大,内存没被回收(Windows环境)
  • ¥65 抖音咸鱼付款链接转码支付宝
  • ¥15 ubuntu22.04上安装ursim-3.15.8.106339遇到的问题
  • ¥15 blast算法(相关搜索:数据库)
  • ¥15 请问有人会紧聚焦相关的matlab知识嘛?