Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
$foo = array('one'); $foofoo = array('onekey' => 'onevalue');
你如何检查一个数组是否只包含一个键?
count()会告诉你数组中有多少元素
count()
if (count($foo) === 1) { echo 'This array contains one value'; }