Home  >  Article  >  Backend Development  >  php heredoc用法注意事项

php heredoc用法注意事项

WBOY
WBOYOriginal
2016-06-23 13:59:35723browse

echo <<<JS<script type="text/javascript">alert( '删除成功' );window.location.href = "index.php?app=homepage&act=module_list";</script>JS;

格式如上

1、标记不能和内容出现在同一行上

2、结束标记必须紧靠行开头

3、标记左右两边不能出现空格

因为用的不多,用时又要忘, 所以记录下来以便查阅

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
Previous article:求教大神一个问题Next article:关于phpURL连接小问题