-2

这是我的输出数组:

Array
(
    [count] => 1
    [0] => Array
        (
            [cn] => Array
                (
                    [count] => 1
                    [0] => Testgroep
                )

            [0] => cn
            [member] => Array
                (
                    [count] => 5
                    [0] => CN=Hans Hansen,OU=Test,DC=stefan,DC=nl
                    [1] => CN=Jaap Jaapen,OU=Test,DC=stefan,DC=nl
                    [2] => CN=Peter Petersen,OU=Test,DC=stefan,DC=nl
                    [3] => CN=Piet Pietersen,OU=Test,DC=stefan,DC=nl
                    [4] => CN=Administrator,CN=Users,DC=stefan,DC=nl
                )

            [1] => member
            [distinguishedname] => Array
                (
                    [count] => 1
                    [0] => CN=Testgroep,OU=Test,DC=stefan,DC=nl
                )

            [2] => distinguishedname
            [samaccountname] => Array
                (
                    [count] => 1
                    [0] => Testgroep
                )

            [3] => samaccountname
            [objectcategory] => Array
                (
                    [count] => 1
                    [0] => CN=Group,CN=Schema,CN=Configuration,DC=stefan,DC=nl
                )

            [4] => objectcategory
            [count] => 5
            [dn] => CN=Testgroep,OU=Test,DC=stefan,DC=nl
        )

)

这是数组的 php 代码:

$result = $adldap->group()->info('Testgroep');

现在我想检查 [1] => member数组的一部分中是否存在值“OU=Test”。我怎样才能做到这一点?我在 stackoverflow 上搜索和搜索,但没有找到解决方案。欢迎您的帮助。

4

1 回答 1

0

试试这个代码

if(strpos($result[0]['distinguishedname'][0], 'OU=Test') !== false) {
    //yep!
}

如果这对您没有帮助,请更新您的问题并添加更多详细信息,以便我们理解。

干杯!

于 2014-04-29T09:41:38.143 回答