Home > Backend Development > PHP Tutorial > 这个数组如何键值取值?

这个数组如何键值取值?

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-13 13:36:01
Original
831 people have browsed it

这个数组怎么键值取值???
[国家/地区:] => Array
  (
  [0] => 中国大陆
  )

我要以键值取值??

------解决方案--------------------
不一定
 key($array)
------解决方案--------------------
抱歉。上面说反了
current() 函数可以返回数组的当前单元,默认的就是第一个
key()取当前单元的键值。
http://www.php.net/manual/zh/function.current.php
------解决方案--------------------
array_keys

遍历获取的键值数组

key配合current一定要先reset
------解决方案--------------------
遗憾的是,你只有一个键一个下标
['[国家/地区:'][0]
------解决方案--------------------
还要啥值,把值当成键用不就行了

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Issues
How to get current date in JavaScript?
From 1970-01-01 08:00:00
0
0
0
datetime - How to get current time in Python
From 1970-01-01 08:00:00
0
0
0
How does a Vue file get the current instance?
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template