PHP判断一个变量是否可以通过foreach进行遍历

<?php
    if( !is_array( $items ) && !$items instanceof Traversable )
        //Throw exception here
?>
posted @ 2016-11-30 11:31  yudis  阅读(1263)  评论(0编辑  收藏  举报