<?php
$str=<<< aaa ;
echo $str;
?>不能使用 报错parse error:syntax error,unexpected T_Encapsed_and_whitespace,expecting T_String or T_variable or T_num_string 我怀疑是不是php.ini要设置什么 我用的php版本是5.3.5 apache版本为2.2.17
在线等 谢谢
$str=<<< aaa ;
echo $str;
?>不能使用 报错parse error:syntax error,unexpected T_Encapsed_and_whitespace,expecting T_String or T_variable or T_num_string 我怀疑是不是php.ini要设置什么 我用的php版本是5.3.5 apache版本为2.2.17
在线等 谢谢
aaa
;
这不是新型的。只是heredoc的语法。
格式为
$str = <<<EOT
sdfefe
sdfefef
dfefefef
EOT;
注意结束符和开始符统一,切结束的地方顶格写,否者会报错。