开发者

php file with <? ?> tags in XAMPP [duplicate]

开发者 https://www.devze.com 2023-02-23 09:33 出处:网络
This question already has answers here: Closed 11 years ago. Possible Duplicate: How to enable PHP short tags ?
This question already has answers here: Closed 11 years ago.

Possible Duplicate:

How to enable PHP short tags ?

Hi

I have Xampp version 1.7.3. While browsing a project it shows error. This is开发者_JAVA技巧 because my php code starts with <?....?> so I want to execute my project with both the <? ..... ?> tag and <?php ....?> tag.

Thanks


You are searching for the short_open_tag directive ;-)


To indicate PHP it should accept <? ... ?> as valid PHP tags, you must put this in your php.ini file :

short_open_tag = On

Instead of what you currently have :

short_open_tag = Off


Notes :

  • You can find out where your php.ini file is using phpinfo().
  • Generally speaking, you should not use short open tags, as those can be disabled (you've just seen that)


Set short_open_tag = on in your php.ini.

You could also use php_flag short_open_tag on on your .htaccess file.

However, you should use <?php as that cannot be disabled!


Don't do it man... <?php is guaranteed valid on any server running PHP. As a trade off for the extra 3 characters, you can omit the closing ?> ... see manual for details.

http://php.net/manual/en/language.basic-syntax.instruction-separation.php

0

精彩评论

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