CodeIgniter view method for displaying array data in a loop
This article mainly introduces the method of CodeIgniter view through the loop display array data, the example analyzes the technique of view method and array traversal in CodeIgniter, has certain reference value, the need friend can refer to the following
The examples in this article describe the way in which view in CodeIgniter displays array data in a loop. Share to everyone for your reference. Specific as follows:
The controller is as follows:
?
1 2 3 4 5 6 7 8 9 10 |
Class Simplecontroller extends Controller { Function index () { $data [' my_list '] = Array ("Do the", "Clean up", "does that"); $this->load->view (' index ', $data); } } ?> |
The Index view is as follows:
?
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
Display array Data Display Array Data foreach ($my _list as $item) { Echo $item; } ?> |
I hope this article is helpful to everyone based on CodeIgniter PHP program design.
http://www.bkjia.com/PHPjc/971956.html www.bkjia.com true http://www.bkjia.com/PHPjc/971956.html techarticle CodeIgniter view by looping through the array data this article mainly introduces the method of CodeIgniter view in the loop display array data, the example analyzes the CodeIgniter view method ...