在$ _POST值中不使用引号vs单引号vs双引号 [英] using no quotes vs single quotes vs double quotes in $_POST value

查看:164
本文介绍了在$ _POST值中不使用引号vs单引号vs双引号的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

可能重复:
我应该使用php引号转义符作为单引号还是在数组中使用双引号?
在PHP中使用array [key]可以吗?

Possible Duplicate:
Should I use php quote escapes for single quotes or use double quotes in arrays?
Is it okay to use array[key] in PHP?

这三个$ _POST值之间有什么区别? :

what is the difference between these three $_POST values? :

$_POST[data];

$_POST['data'];

$_POST["data"];

推荐答案

第一个,索引是常量data.由于这可能是未定义的,PHP通常会将其转换为字符串'data'并记录警告消息.

The first one, the index is the constant data. Since that is likely undefined, PHP will often just convert it to the string 'data' and log a warning message.

后两个都是相同的.索引是字符串'data'.

The second two are both identical. The index is the string 'data'.

这篇关于在$ _POST值中不使用引号vs单引号vs双引号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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