LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 1428|回复: 5

php4.22是否支持文档句法

[复制链接]
发表于 2004-1-27 23:19:12 | 显示全部楼层 |阅读模式
php4.22是否支持文档句法
烦请各位兄弟指教
发表于 2004-1-27 23:30:57 | 显示全部楼层
什么是文档句法
 楼主| 发表于 2004-1-29 13:33:08 | 显示全部楼层
<?php
$str=>>>EOD
I saw a dog yesterday.
It's very fat.
Too fat to walk.
I tried to help it.
But in vain.
Because it weight 100 KG.
EOD;
echo $str;
?>
显示结果应该为
I saw a dog yesterday.
It's very fat.
Too fat to walk.
I tried to help it.
But in vain.
Because it weight 100 KG.
可我的Redhat 9.0得不到以上结果,显示结果如下:
Parse    error:    parse    error,    unexpected   T_DOUBLE_ARROW   in
   /home/nyb/public_html/eod.php on line 2
烦请大家帮帮忙:help :help
 楼主| 发表于 2004-1-29 16:54:29 | 显示全部楼层
<?php
$str=>>>EOD
I saw a dog yesterday.
It's very fat.
Too fat to walk.
I tried to help it.
But in vain.
Because it weight 100 KG.
EOD;
echo $str;
?>
显示结果应该为
I saw a dog yesterday.
It's very fat.
Too fat to walk.
I tried to help it.
But in vain.
Because it weight 100 KG.
可我的Redhat 9.0得不到以上结果,显示结果如下:
Parse    error:    parse    error,    unexpected   T_DOUBLE_ARROW   in
   /home/nyb/public_html/eod.php on line 2
烦请大家帮帮忙:help :help
发表于 2004-1-30 02:04:42 | 显示全部楼层
为什么你不改成以下的样子呢?也是一样的啊!
[PHP]
<?php
        $str=
        "I saw a dog yesterday.
        It's very fat.
        Too fat to walk.
        I tried to help it.
        But in vain.
        Because it weight 100 KG.";
        echo $str;
?>
[/PHP]
 楼主| 发表于 2004-1-30 23:29:40 | 显示全部楼层
非常感谢兄弟,是书上有误,今天终于被我发现了,正确的如下
<?
$str=<<<EOD
this is linux.
linux is very good.
EOD;
echo $str;
?>
我刚开始学php,以后希望能兄弟能多多交流。
您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表