XAMPP does not recognize php, must replace all <? with <?php

This question already has an answer here:

  • Are PHP short tags acceptable to use? 25 answers
  • php file with <? ?> tags in XAMPP [duplicate] 3 answers

  • You'll have to enable short_open_tag in php.ini

    However, for compatibility reasons with system where you haven't control over the php.ini, I would not use the short open tags.


    That's because XAMPP has php short tags turned off. That's a good thing, as many enviroments have, as default, the same setting, and some don't let you turn it back on. But note, as of php 5.4, <?= ?> tags don't count as short tags, and can be used while short tags are turned off.


    In your php.ini there is an option for allow short tags just turn it on. It will work ie

    short_open_tag =  on
    
    链接地址: http://www.djcxy.com/p/59428.html

    上一篇: 使用<?php?> VS. <? ?>

    下一篇: XAMPP不识别PHP,必须替换所有的<? 与<?php