I am trying to parse a csv file using fgetcsv()
function but the CSV file's heading consists value like E-mail Address'
which I need to convert as an array's key but I am wondering if it's OK to use a non-standard name for a key?
我试图使用fgetcsv()函数解析csv文件,但CSV文件的标题包含像电子邮件地址这样的值,我需要将其转换为数组的密钥,但我想知道是否可以使用非标准名称关键?
I would be saving this value in database directly so I am not sure if getting a value like this $entry['E-mail Address']
would be ok
我会直接在数据库中保存这个值,所以我不确定是否得到像这样的$ entry ['E-mail Address']这样的值就可以了
1 个解决方案
#1
2
A string is a string. The fact that it has a whitespace in the middle shouldn't prevent you from using it as an array's key.
字符串是一个字符串。它在中间有一个空格的事实不应该阻止你将它用作数组的键。
#1
2
A string is a string. The fact that it has a whitespace in the middle shouldn't prevent you from using it as an array's key.
字符串是一个字符串。它在中间有一个空格的事实不应该阻止你将它用作数组的键。