PHP.ini有什么变量可以放宽对变量的需求吗?

时间:2011-01-10 10:38:33

标签: php

我正在尝试镜像我的ISP服务器,他将此设置为严格,您需要指定$

我不

这是什么?

修改

这适用于我的测试服务器

if (nothingfound != "TRUE") {

但不在实时服务器上

if ($nothingfound != "TRUE") {

两者都在运行PHP 5.2.17(目前我无法升级到5.3)

1 个答案:

答案 0 :(得分:4)

if (nothingfound != "TRUE") {

实际上只能起作用,因为PHP会查找一个名为nothingfound的常量,如果找不到,它会将该标记视为文字字符串'nothingfound'。根据您的error_reporting,PHP会发出通知,例如

Notice: Use of undefined constant nothingfound - assumed 'nothingfound' in ...

所以坚持你的例子

if (nothingfound != "TRUE") {

有效,但

if (nothingfound == "TRUE") { 

将永远不会起作用(除非您定义的常量nothingfound包含字符串"TRUE")。