Why is “<?” no longer working and instead only “<?php” works?

六眼飞鱼酱① 提交于 2019-12-05 06:11:40

This is a php.ini setting named

short_open_tag = 1 # (enabled)

I recommend you to disable short_open_tag and only work with <?php. When short_open_tag is enabled, it can collide with the XML processing instruction <?xml as both the PHP open tag and XML PI start with a <?.

daniel

By using only <? as start preprocessor startup, you can get the preprocessor confused with well formed XML documents. XML stands <? for processing-instruction, imagine an XHTML document with embeded XML that requires XSLT processing... The preprocessor will get confused with the stylesheet processing instruction and will throw an error.

It's higly recomended to use the <?php processor starting tag, try using the short_open_tag = Off in your php.ini. Also, you can try using <?php ini_set('short_open_tag', 'On'); > if you are getting problems.

You can set short_open_tag = On in the php.ini

It's a configuration option, more information on: http://www.php.net/ini.core (look for short_open_tag).

For the newer version:

short_open_tag = On
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!