`
wsql
  • 浏览: 11792274 次
  • 性别: Icon_minigender_1
  • 来自: 深圳
文章分类
社区版块
存档分类
最新评论

为什么Discuz会显示原码?

 
阅读更多

今天安装了Discuz之后,打开是PHP原码, 开始以为是Apache配置有问题,但是我在Discuz的目录写了简单的PHP程序,却能执行。实际上,Discuz的PHP程序是被执行了,而且上传到网站上也是好的,所以只好看Discuz原码,最后发现

include template("discuz")

模板文件里的PHP不能执行,打开之后发现所有的模板文件里的PHP标记都是<?, 而一般都是<?php, 这个可以在PHP.ini里找到这个开关short_open_tag,最后问题终于解决了。

; 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 就是允许短标记, Off就是禁止短标记。

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics