-3

I have a little problem. After installed xampp on localhost I saw, that my PHP doesn't accept <?. When I have only <? it will show me error:

Parse error: syntax error, unexpected end of file in D:\xampp\htdocs\admin.php on line 1113.

On my web server it works well. But when I replace <? to <?php, it works on localhost too. I have a lot of files with just a <? and don't have enough time to replace every <?. Is here any way to allow only <? on localhost?


You are experiencing the pain of short tags.

Your best bet is to stop using them as you might end up using hosting which has them turned on in the future.

You can configure PHP to support them if you really want to though.

4

3 回答 3

1

you probably have to check your php.ini there is one parameter short_open_tag tells php to recognize <? as php code beginning tag or not, here is some more information about this param:

php.net:ini.short-open-tag

于 2013-08-19T10:57:58.490 回答
1

your question is not full, but if i understood correctly, it's not accepting the <?php

you can change the behavior in php.ini ---> short_opentag=On

but my advice is to always use the <?php tag. sorry if this is not what you are asking for but this is what I understood from the title of the question.

于 2013-08-19T10:57:59.837 回答
0

您正在经历短标签的痛苦。

您最好的选择是停止使用它们,因为您最终可能会使用托管,而这些托管将来会打开它们。

如果你真的想要,你可以配置 PHP来支持它们。

于 2013-08-19T10:57:16.753 回答