php - 使用 file_get_contents 时获取数组值
问题描述
我试图从其他文件中的数组中获取单个值,这是我到目前为止的代码
$data = file_get_contents('order.log', true);
$name = $data['0']['customer_last_name'];
echo $name;
这是我的数组文件的一部分:
Array
(
[0] => Array
(
[customer_id] => 1364
[customer_group_id] => 1
[customer_first_name] => penna
[customer_last_name] => Macii
[customer_email] => mail8@abv.bg
[customer_ip] => 1601136638
[note_customer] =>
[note_administrator] =>
[quantity] => 3
[weight] => 0
[vat_included] => yes
[email_sent] =>
[status] => pending
[customer_geoip] => Array
(
[city] => Sofia
[state] => Sofia-Capital
[country] => Bulgaria
[country_iso] => BG
[timeZone] => Europe/Sofia
[lon] => 42.683
[lat] => 23.3175
)
输出是
A
解决方案
推荐阅读
- python - tokenizer.texts_to_sequences Keras Tokenizer 几乎全为零
- c# - DbConnectionStringBuilder 和 OdbcConnectionStringBuilder 连接字符串的区别
- java - 如何在 Java 项目中放置 txt 文件?
- python - 在 python 中创建时间序列数据
- c - 分别从/向标准输入/标准输出读取/写入时的 CGI 程序超时
- python - Python如何从索引1开始?查找月份的功能
- jquery - 是否建议将克隆选择列表选项作为优化策略?
- php - Yii2:没有 Swiftmailer 的 PHP 邮件?
- python - 如何使用opencv python将RGB颜色范围更改为红色
- python - 无法使用 Docker 运行项目