是否可以检查并获取数组的内部键的值?这很容易解释,但不可能实现!所以用几句话,我有多级数组,如: ARRAY ( 1KEY ARRAY ( 2KEY => 2VAL, 3KEY = 3VAL ) )我需要检查是否2KEY存在以及value它有什么!这是我正在处理的代码:<?php$array = array ( "first.php" => array ( "edit" => "0", "add" => "1", "delete" => "0", ), "second.php" => array ( "edit" => "1", "add" => "1", "delete" => "1", ) );//This checks the current page that we are if it exists in array,if (isset($array[$_SERVER['PHP_SELF']])) { //Pass permissions into variables $allowEdit = isset($array['edit'])?"1":"0"; $allowAdd = isset($array['add'])?"1":"0"; $allowDelete = isset($array['delete'])?"1":"0";} else { echo "This page don't exist!";}?>
- 2 回答
- 0 关注
- 191 浏览
添加回答
举报
0/150
提交
取消