PHP从关联数组获取密钥 [英] Php get keys from associative array
本文介绍了PHP从关联数组获取密钥的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我怎么只能从数组中获取整个第一行.(我使用Laravel)
How could I get only the entire first row from an array. (I use Laravel)
例如,当我说:
$request-all();
我收到:
array:2 [
"email" => "james@hotmail.com"
"password" => "adms|Wh"
]
我想收到:
email
password
推荐答案
如果我正确理解了您的问题,则需要这样的东西:
If I understood your question correctly, you want something like this:
$keys = array_keys($array);
foreach ($keys as $key){
echo $key;
}
这篇关于PHP从关联数组获取密钥的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文