在我的項目中,我有數組,當我使用pre
標籤回顯它時,它顯示如下。如何找到存在於兩維數組中的值
Array
(
[0] => stdClass Object
(
[minute] => 1,31
[hour] => 0-5
[mday] => *
[month] => *
[wday] => *
[who] => root
[command] => /usr/bin/nice -n20 adjkerntz -a
)
[1] => stdClass Object
(
[minute] => 1
[hour] => 3
[mday] => 1
[month] => *
[wday] => *
[who] => root
[command] => /usr/bin/nice -n20 /etc/rc.update_bogons.sh
)
[2] => stdClass Object
(
[minute] => */60
[hour] => *
[mday] => *
[month] => *
[wday] => *
[who] => root
[command] => /usr/bin/nice -n20 /usr/local/sbin/expiretable -v -t 3600 sshlockout
)
[3] => stdClass Object
(
[minute] => */60
[hour] => *
[mday] => *
[month] => *
[wday] => *
[who] => root
[command] => /usr/bin/nice -n20 /usr/local/sbin/expiretable -v -t 3600 webConfiguratorlockout
)
[4] => stdClass Object
(
[minute] => 1
[hour] => 1
[mday] => *
[month] => *
[wday] => *
[who] => root
[command] => /usr/bin/nice -n20 /etc/rc.dyndns.update
)
[5] => stdClass Object
(
[minute] => */60
[hour] => *
[mday] => *
[month] => *
[wday] => *
[who] => root
[command] => /usr/bin/nice -n20 /usr/local/sbin/expiretable -v -t 3600 virusprot
)
[6] => stdClass Object
(
[minute] => 30
[hour] => 12
[mday] => *
[month] => *
[wday] => *
[who] => root
[command] => /usr/bin/nice -n20 /etc/rc.update_urltables
)
[7] => stdClass Object
(
[minute] => */1
[hour] => *
[mday] => *
[month] => *
[wday] => *
[who] => root
[command] => /usr/local/www/checksum.php
)
)
現在我要檢查,如果命令=在/ usr /本地/網絡/ checksum.php是存在與否。所以,我做了這個代碼
if (!in_array('/usr/local/www/checksum.php', $array['command'])) {
echo 'not';
}
else{
echo 'yes';
}
但它始終沒有迴音......並顯示如下消息,警告:未定義指數:命令。我不知道該怎麼做。請幫幫我。
價值,因爲它是'stdClass的Object'所以你需要像這樣訪問值'$按行> command' – JYoThI