常量无法在服务器上解析

时间:2015-12-25 11:01:22

标签: php configuration centos ubuntu-14.04 constants

constants.php

<?
  define('GREETING', 'Hello World');
?>

的index.php

<?php
  require("constants.php");
  echo GREETING; 
?>

此代码给出了一个错误:PHP Notice: Use of undefined constant GREETING - assumed 'GREETING'

(服务器1 - 不工作) Ubuntu 14.04

PHP 5.5.9-1ubuntu4.14 (cli) (built: Oct 28 2015 01:34:46)
Copyright (c) 1997-2014 The PHP Group
Zend Engine v2.5.0, Copyright (c) 1998-2014 Zend Technologies
    with Zend OPcache v7.0.3, Copyright (c) 1999-2014, by Zend Technologies

(服务器2 - 工作) CentOS 6.3

PHP 5.4.13 (cli) (built: Mar 14 2013 08:57:49)
Copyright (c) 1997-2013 The PHP Group
Zend Engine v2.4.0, Copyright (c) 1998-2013 Zend Technologies
    with the ionCube PHP Loader v4.6.0, Copyright (c) 2002-2014, by ionCube Ltd.

(开发环境 - 工作) Windows 8.1

PHP 5.5.9 (cli) (built: Feb  5 2014 13:02:39)
Copyright (c) 1997-2014 The PHP Group
Zend Engine v2.5.0, Copyright (c) 1998-2014 Zend Technologies
    with the ionCube PHP Loader v4.5.3, Copyright (c) 2002-2014, by ionCube Ltd.

可能是什么问题以及如何使其适用于服务器1

1 个答案:

答案 0 :(得分:0)

以前的程序员使用短标签将块变成注释