使用常量出错 [英] Getting an error using constants

查看:35
本文介绍了使用常量出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有很多页面,所有页面都需要文件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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆