Home >Backend Development >PHP Tutorial >php 定界符格式引起的错误_PHP

php 定界符格式引起的错误_PHP

WBOY
WBOYOriginal
2016-06-01 12:16:51984browse

错误代码:Parse error: syntax error, unexpected $end in H:\wamp\www\testing\test\2.1.4.php on line 16
错误源代码:
复制代码 代码如下:
$str =
测试字符串

测试字符串

测试字符串
  EOD;
echo $str;
//为定界符定义使用的变量
$name = '爱因斯坦';
$dicta = "想象力比知识更重要,因为知识是有限的,而想象力是无限的";
$size = 5;
echo

said:"{$dicta}"
  EOT;
?>

Eclipse错误图片
php 定界符格式引起的错误_PHP
错误图片
这个错误其实很简单,就是在定界符EOD和EOT结尾时,前边 加了Tab,解决办法是顶格写 "EOD;" 和"EOT;" 。相信各位初学者也有和我一样的经历吧……
正确代码:
复制代码 代码如下:
$str =
测试字符串

测试字符串

测试字符串
  EOD;
echo $str;
//为定界符定义使用的变量
$name = '爱因斯坦';
$dicta = "想象力比知识更重要,因为知识是有限的,而想象力是无限的";
$size = 5;
echo

said:"{$dicta}"
  EOT;
?>

结果截图:
php 定界符格式引起的错误_PHP

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn