开发者

PHP is making me use <?php instead of <?

My Apache/PHP installation is making me use <?php ... ?> instead of <? ... ?>. Where is this found 开发者_JS百科in the configuration file so that I don't need to do the former? I'm assuming it's in php.ini, but not sure what it would be called.


It's the short_open_tag configuration directive. http://php.net/manual/en/ini.core.php


It is defined in php.ini as short_open_tag.

Keep in mind however, for maximum portability, stick with <?php ... ?>. You have just proved to yourself how unreliable it is to rely on short tags being enabled. You wouldn't want to show the world your PHP source if it made its way onto a short tag disabled server would you?

I've also read, but can not confirm, that short tags will be removed in newer versions of PHP.


Definitely keep using <?php instead of <?, it's good practice and it makes your code more readily mobile for other projects and websites that may have short_open_tag enabled or disabled.


The option is called short_open_tag.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜