PHP Question: How to fix these if/elseif statements

前端 未结 4 880
别跟我提以往
别跟我提以往 2021-01-23 16:30

I am trying to use these if/else if statements to display these php pages. The if/elseif statements allow for the php page to show up. The data is stored in the mysql. How do we

4条回答
  •  野的像风
    2021-01-23 17:18

    It looks like you're iterating over an array of options, and including a bunch of set files?

    I would try something like the following:

    switch( TRUE )
    {
        case in_array("Politics", $result_array):
            require 'news/political.php';
            break; 
    
        case in_array("Gossip", $result_array):
            require 'news/celebgossib';
            break;
    
        // etc.
    }
    

提交回复
热议问题