0
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?
如果消息提到'GREETINGS'和常數是'GREETING'短標記的,那麼它們是不同的 –