php关于尾部去除和分号问题
Posted 熊二
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了php关于尾部去除和分号问题相关的知识,希望对你有一定的参考价值。
One thing to remember is, if you decide to omit the closing php tag, then the last line of the file should be ended with semi colon. If you add the closing tag then last line doesn‘t need to end with semi colon.
<?php
echo "First line";
echo "Last line"
The above code throws error as it neither has closing tag nor semicolon ending. So it should be replaced with either of the below two
<?php
echo "First line";
echo "Last line";
or
<?php
echo "First line";
echo "Last line" ?>
如果需要保存尾部的换行,在?>后面添加一个空格或者换行
以上是关于php关于尾部去除和分号问题的主要内容,如果未能解决你的问题,请参考以下文章