使用常量获取错误 [英] Getting an error using constants
本文介绍了使用常量获取错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有很多页面,所有页面require
是文件characters.php
.该文件包含定义我的网站中许多内容的常量.它们的定义是这样的,例如:
I have a lot of pages, all of which require
the file characters.php
. This file contains constants which define many things in my website. They are defined like this, for example:
const $humanHEALTH = 1.1;
一切都可以使用WAMP在我的本地主机中正常运行,但是当我将其上传到在线主机时,会出现此错误:
Everything works properly running it in my localhost using WAMP, but when I upload it to an online host I get this error:
解析错误:语法错误,意外的T_CONST
Parse error: syntax error, unexpected T_CONST
我在其中一页上使用了phpinfo()
,PHP版本是5.2.17.
I used phpinfo()
on one of the pages and the PHP version is 5.2.17.
任何帮助将不胜感激.
推荐答案
在PHP 5.2中,它是define('constant_name', 'value');
In PHP 5.2 it's define('constant_name', 'value');
这篇关于使用常量获取错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文