当前位置:Gxlcms > PHP教程 > 使用界定符号的有关问题

使用界定符号的有关问题

时间:2021-07-01 10:21:17 帮助过:3人阅读

使用界定符号的问题。
class Work {

public function setXml(){
$_xml=<<
eof;
}
}
这是就会显示错误cannot reclare function setxml
但是我在函数中用此界定符就没有问题,是不是界定符不能再类的方法中用了?


------解决方案--------------------
能。这就是全部代码?
------解决方案--------------------
类中可使用界定符
检查你的类是否其他地方有再定义了setXml()
------解决方案--------------------
http://www.php.com/manual/zh/language.types.string.php#language.types.string.syntax.heredoc
------解决方案--------------------
那是因为你的 eof; 后面有一个TAB字符

人气教程排行