Invalid argument supplied for foreach()

后端 未结 19 1776
花落未央
花落未央 2020-11-21 06:32

It often happens to me to handle data that can be either an array or a null variable and to feed some foreach with these data.

$values = get_val         


        
19条回答
  •  孤街浪徒
    2020-11-21 06:38

    Warning invalid argument supplied for foreach() display tweets. go to /wp-content/plugins/display-tweets-php. Then insert this code on line number 591, It will run perfectly.

    if (is_array($tweets)) {
        foreach ($tweets as $tweet) 
        {
            ...
        }
    }
    

提交回复
热议问题