【发布时间】:2017-02-16 10:01:02
【问题描述】:
我有一个 PHP MVC 网站,在我看来有很多这样的代码:
<? if($this->unallocatedCount > 0 && Session::get("user_internal") == "1"): ?>
something
<? endif; ?>
它在 PHP5 中运行良好,但是我在使用 PHP7 的 Linux 服务器上托管同一网站的副本,并且此代码未正确执行。它的作用是执行这个:<? if($this->,然后简单地输出它的其余部分。
这是典型的 PHP7 行为还是我只需要更改服务器上的 PHP 设置?
【问题讨论】:
-
php short_open_tags 在 php 7 中默认是禁用的,你可能需要从 php.ini 启用它,看看php.net/manual/en/language.basic-syntax.phptags.php
-
php 7:- short_open_tag 被禁用。
-
short_open_tag的正确拼写也是如此
标签: php html php-7 ubuntu-16.04