Getting an error using constants(使用常量出错)
问题描述
我有很多页面,所有页面都需要
文件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');
这篇关于使用常量出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:使用常量出错


- 从 PHP 中的输入表单获取日期 2022-01-01
- Laravel 仓库 2022-01-01
- 正确分离 PHP 中的逻辑/样式 2021-01-01
- 带有通配符的 Laravel 验证器 2021-01-01
- 如何定位 php.ini 文件 (xampp) 2022-01-01
- Mod使用GET变量将子域重写为PHP 2021-01-01
- PHP Count 布尔数组中真值的数量 2021-01-01
- Oracle 即时客户端 DYLD_LIBRARY_PATH 错误 2022-01-01
- SoapClient 设置自定义 HTTP Header 2021-01-01
- 没有作曲家的 PSR4 自动加载 2022-01-01