相关疑难解决方法(0)

PHP错误消息"通知:使用未定义的常量"是什么意思?

PHP在日志中写入此错误:"注意:使用未定义的常量".

日志错误:

PHP Notice:  Use of undefined constant department - assumed 'department' (line 5)
PHP Notice:  Use of undefined constant name - assumed 'name' (line 6)
PHP Notice:  Use of undefined constant email - assumed 'email' (line 7)
PHP Notice:  Use of undefined constant message - assumed 'message' (line 8)
Run Code Online (Sandbox Code Playgroud)

相关代码行:

$department = mysql_real_escape_string($_POST[department]);
$name = mysql_real_escape_string($_POST[name]);
$email = mysql_real_escape_string($_POST[email]);
$message = mysql_real_escape_string($_POST[message]);
Run Code Online (Sandbox Code Playgroud)

它是什么意思,我为什么看到它?

php constants undefined

149
推荐指数
3
解决办法
57万
查看次数

引号等

有没有不同的打字:

<?php echo $_SERVER[REQUEST_URI] ?>
Run Code Online (Sandbox Code Playgroud)

<?php echo $_SERVER['REQUEST_URI'] ?>
Run Code Online (Sandbox Code Playgroud)

最后

<?php echo $_SERVER["REQUEST_URI"] ?>?
Run Code Online (Sandbox Code Playgroud)

他们都工作......我用的是第一个.也许一个比另一个快?

谢谢

一个Noob

php

7
推荐指数
1
解决办法
7660
查看次数

标签 统计

php ×2

constants ×1

undefined ×1