1
のOU値を取得しますが、取得する方法を理解していません。PHPのLDAPは</p> <p><code>dn: uid=john,ou=grp1,ou=people,dc=site,dc=com</code>から私は<code>ou=grp1</code>として値を取得するためのコードの下にしようとしているDN
<?php
function pairstr2Arr ($str, $separator='=', $delim=',') {
$elems = explode($delim, $str);
foreach($elems as $elem => $val) {
$val = trim($val);
$nameVal[] = explode($separator, $val);
$arr[trim(strtolower($nameVal[$elem][0]))] = trim($nameVal[$elem][1]);
}
return $arr;
}
// Example usage:
$string = 'uid=john,ou=grp1,ou=people,dc=site,dc=com';
$array = pairstr2Arr($string);
echo '<pre>';
print_r($array);
echo '</pre>';
?>
出力:
<pre>Array
(
[uid] => john
[ou] => people //here I want to get output ou=grp1,how?
[dc] => com
)
</pre>
がここに出力を見つける:ここ
がコードされているのでou
とdc
のhttps://ideone.com/rE6eaH