php file with <? ?> tags in XAMPP [duplicate]
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 usingphpinfo()
. - 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
精彩评论