开发者

does PHP Version 5.3.2 work without <?php woth with <?

i have one complete website

which was written in php4, now my hosting server is PHP Version 5.3.2, windows 2008 server

and my site is not working, what i found is old site use following syntax

<?

but if i change it into

<?p开发者_如何学编程hp

page start working. is there any way to solve this issue...

  1. PHP Version 5.3.2 work with

    <?
    
  2. any script which change all

    <? to <?php 
    

in all pages.


This is not down to the PHP version, but depends on the short_open_tag php.ini setting.

You can change the ini setting to "1", but the use of short open tags is generally discouraged these days.


Short tags are a discouraged feature of PHP. You should convert all <? to <?php, because as of PHP 6.0, they will be deprecated. (This is partially to better support XML documents, which have a tag that starts with <?)

BTW, you can turn them on in your configuration.


the following code snippet helped me convert all short tags to proper PHP tags, hope it helps you too:

  • REPLACING SHORT TAGS WITH PROPER PHP TAGS (archived copy)


There is a directive in your php.ini file called "short_open_tag". This is what allows you to use the shorthand or not. They should not be used anymore though, so its better if you update all tags to the new format.

Metropolis

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜