Home >Backend Development >PHP Tutorial >The method of displaying array data through loop in view in codeigniter, codeigniterview_PHP tutorial

The method of displaying array data through loop in view in codeigniter, codeigniterview_PHP tutorial

WBOY
WBOYOriginal
2016-07-13 10:02:05908browse

The view in codeigniter displays array data through a loop, codeigniterview

This article describes the example of the view in codeigniter displaying the array data through a loop. Share it with everyone for your reference. The details are as follows:

The controller is as follows:

<&#63;php
class SimpleController extends Controller
{
function index()
 {
  $data['my_list'] = array("do this", "clean up", "do that");
  $this->load->view('index', $data);
 }
}
&#63;>

Index view is as follows:

<html>
<head>
<title>display array data</title>
</head>
<body>
<h1>Display array data</h1>
<&#63;php
foreach($my_list as $item)
{
 echo $item;
}
&#63;>
</body>
</html>

I hope this article will be helpful to everyone’s PHP programming based on codeigniter.

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/970983.htmlTechArticleHow the view in codeigniter displays array data through a loop, codeigniterview This article describes the example of how the view in codeigniter displays array data through a loop method. Share it with everyone for your reference...
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn