Codeigniter: Passing data from controller to view

后端 未结 13 2151
忘了有多久
忘了有多久 2020-11-27 06:57

I want to pass $data from the controller named poll to the results_view however I am getting an undefined variable error.

         


        
13条回答
  •  刺人心
    刺人心 (楼主)
    2020-11-27 07:27

    you can do it this way

    defined array in controller

    $data['hello'] = "hello";
    

    and pass variable to view

    echo $hello; 
    

提交回复
热议问题