douzhan1963
2015-06-16 05:54
浏览 141
已采纳

可以使用带有空格的数组键

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?

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

图片转代码服务由CSDN问答提供 功能建议

我试图使用 fgetcsv()函数解析csv文件,但CSV文件是 标题包含像 E-mail Address'这样的值,我需要将其转换为数组的键,但我想知道是否可以使用非标准名称作为键? \ n

我会直接在数据库中保存这个值,所以我不确定是否得到像这样的 $ entry ['E-mail Address'] 这样的值

  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

1条回答 默认 最新

  • douwei2713 2015-06-16 05:56
    已采纳

    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.

    打赏 评论

相关推荐 更多相似问题