PHP 命名常量打印/连接作为变量名,而不是值
我有一个旧的 osCommerce 网站,以前是 PHP4,现在运行在 PHP5 上。使用 define()
定义的命名常量计算不正确:
$string = '<a href="http://www.oscommerce.com" target="_blank">' . BOX_ENTRY_SUPPORT_SITE . '</a><br>';
将显示为 BOX_ENTRY_SUPPORT_SITE
,而不是 BOX_ENTRY_SUPPORT_SITE
中放置的值。
需要更改 php.ini 中的某些内容吗?
I have an old osCommerce site that was PHP4, now running on PHP5. Named constants defined with define()
are being evaluated incorrectly:
$string = '<a href="http://www.oscommerce.com" target="_blank">' . BOX_ENTRY_SUPPORT_SITE . '</a><br>';
will show as BOX_ENTRY_SUPPORT_SITE
, not the value placed in BOX_ENTRY_SUPPORT_SITE
.
Something needs to be changed in php.ini
?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
不,据我所知常量行为没有改变。
很可能该常量没有定义;尝试找到它的定义位置并查看该文件是否由您的脚本加载(即:通过 require 或 include)
No, AFAIK constants behavior hasn't changed.
Most likely the constant is not defined; try to find where it's being defined and see if the file is being loaded by your script (ie: by require or include)
当我将 osCommerce 网站从 PHP4 放到 PHP5 上时,我从未遇到过这个问题。
最有可能的是,该定义没有被正确地
define()
定义。 默认行为(放宽错误报告)是在未找到常量时显示该常量。I never ran into this problem when putting osCommerce sites on PHP5 from PHP4.
Most probably, that define isn't being
define()
'd correctly. The default behaviour (with error reporting relaxed) is to show the constant like that when it isn't found.