为什么php必须<?php 开头,<? 这样就直接显示源码了。昨天刚弄好的,在windows下linux+apache+php+mysql.
昨天<?echo "a";?> 还行
今天我要用mysql,把mysql配了一下以后,我游览php文件就出错了,都是直接输出源码。
后来发现<?php ?>这样的正长,<? ?>这样的全部直接显示源码。

解决方案 »

  1.   

    ; Allow the <? tag.  Otherwise, only <?php and <script> tags are recognized.
    ; NOTE: Using short tags should be avoided when developing applications or
    ; libraries that are meant for redistribution, or deployment on PHP
    ; servers which are not under your control, because short tags may not
    ; be supported on the target server. For portable, redistributable code,
    ; be sure not to use short tags.
    short_open_tag = On                   //把这个开关设置成ON就开启<?短标记了
      

  2.   

    这只是一个识别。在ini里定义,告诉系统,这块是php。