Table of Contents
Display array data
Home Backend Development PHP Tutorial codeigniter中view通过循环显示数组数据的方法_PHP

codeigniter中view通过循环显示数组数据的方法_PHP

May 31, 2016 am 11:45 AM
codeigniter view cycle number show

本文实例讲述了codeigniter中view通过循环显示数组数据的方法。分享给大家供大家参考。具体如下:

controller如下:

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

Index view如下:

<html>
<head>
<title>display array data</title>
</head>
<body>
<h1 id="Display-array-data">Display array data</h1>
<&#63;php
foreach($my_list as $item)
{
 echo $item;
}
&#63;>
</body>
</html>
Copy after login

希望本文所述对大家基于codeigniter的php程序设计有所帮助。

Statement of this Website
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

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
WWE 2K25: How To Unlock Everything In MyRise
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Reasons and solutions for desktop layout being locked Reasons and solutions for desktop layout being locked Feb 19, 2024 pm 06:08 PM

What happens when the desktop layout is locked? When using the computer, sometimes we may encounter the situation where the desktop layout is locked. This problem means that we cannot freely adjust the position of desktop icons or change the desktop background. So, what exactly is going on when it says that the desktop layout is locked? 1. Understand the desktop layout and locking functions. First, we need to understand the two concepts of desktop layout and desktop locking. Desktop layout refers to the arrangement of various elements on the desktop, including shortcuts, folders, widgets, etc. we can be free

How to display the wifi password QR code? It is recommended to scan the wifi password on WeChat in 3 seconds. How to display the wifi password QR code? It is recommended to scan the wifi password on WeChat in 3 seconds. Feb 20, 2024 pm 01:42 PM

You don’t need to enter the WIFI password often, so it’s normal to forget it. Today I will teach you the simplest way to find the password of your own WIFI. It can be done in 3 seconds. To check the WIFI password, use WeChat to scan it. The premise of this method is: there must be a mobile phone that can connect to WIFI. Okay, let’s start the tutorial: Step 1. We enter the phone, pull down from the top of the phone, bring up the status bar, and the WIFI icon. Step 2. Long press the WIFI icon to enter the WLAN settings; long press the WIFI icon. Step 3. Click Connected. Enter the WIFI name of your home, click Share Password, and a QR code will pop up; Step 4 of sharing WIFI password, we take a screenshot and save this QR code; Step 5, long press the WeChat icon on the desktop, and click Scan

How to check the current directory in Linux? How to check the current directory in Linux? Feb 23, 2024 pm 05:54 PM

In Linux systems, you can use the pwd command to display the current path. The pwd command is the abbreviation of PrintWorkingDirectory and is used to display the path of the current working directory. Enter the following command in the terminal to display the current path: pwd After executing this command, the terminal will display the full path of the current working directory, such as: /home/user/Documents. In addition, you can use some other options to enhance the functionality of the pwd command. For example, the -P option can display

Samsung will provide displays for Microsoft's MR headsets, and the devices are expected to be lighter and have clearer displays Samsung will provide displays for Microsoft's MR headsets, and the devices are expected to be lighter and have clearer displays Aug 10, 2024 pm 09:45 PM

Recently, Samsung Display and Microsoft signed an important cooperation agreement. According to the agreement, Samsung Display will develop and supply hundreds of thousands of OLEDoS panels for mixed reality (MR) head-mounted devices to Microsoft. Microsoft is developing an MR device for multimedia content such as games and movies. This device is expected to It will be launched after the OLEDoS specifications are finalized, mainly serving the commercial field, and is expected to be delivered as early as 2026. OLEDoS (OLED on Silicon) technology OLEDoS is a new display technology that deposits OLED on a silicon substrate. Compared with traditional glass substrates, it is thinner and has higher pixels. OLEDoS display and ordinary display

Lambda expression breaks out of loop Lambda expression breaks out of loop Feb 20, 2024 am 08:47 AM

Lambda expression breaks out of the loop, specific code examples are needed. In programming, the loop structure is an important syntax that is often used. However, in certain circumstances, we may want to break out of the entire loop when a certain condition is met within the loop body, rather than just terminating the current loop iteration. At this time, the characteristics of lambda expressions can help us achieve the goal of jumping out of the loop. Lambda expression is a way to declare an anonymous function, which can define simple function logic internally. It is different from an ordinary function declaration,

win7 cannot shut down normally and keeps showing that it is shutting down win7 cannot shut down normally and keeps showing that it is shutting down Jan 06, 2024 pm 07:41 PM

The win7 system is an excellent system that is liked by most computer users. However, recently many win7 system users have reported that their computers cannot shut down and keep showing that they are shutting down! Today, the editor will bring you a solution to the problem that Win7 cannot shut down. Let’s take a look. Solutions to the problem that Windows 7 cannot shut down and keeps showing that it is shutting down: various reasons and solutions: Method 1: 1. First check if there are any unclosed software. If there are any, exit them and then try to shut down again. 2. After clicking the shutdown command, the problem persists. If you cannot shut down the computer, it is most likely due to the interference of processes in the computer. Right-click the mouse on the taskbar, click "Task Manager" and select "Processes". 3. You can observe everything running on the computer during the process.

What is the difference between full-width characters and half-width characters? What is the difference between full-width characters and half-width characters? Mar 25, 2024 pm 03:54 PM

What is the difference between full-width characters and half-width characters? In our daily life, we often encounter the two concepts of full-width characters and half-width characters, especially in input methods, typesetting, printing, etc., which involve the use of these two characters. So, what is the difference between full-width characters and half-width characters? Let us discuss this issue below. First of all, full-width characters and half-width characters were concepts originally introduced by Chinese typewriters. The so-called half-width characters are characters that occupy half the width of a character, usually referring to English characters and Arabic numerals. Full-width characters occupy

PHP returns all the values ​​in the array to form an array PHP returns all the values ​​in the array to form an array Mar 21, 2024 am 09:06 AM

This article will explain in detail how PHP returns all the values ​​of an array to form an array. The editor thinks it is quite practical, so I share it with you as a reference. I hope you can gain something after reading this article. Using the array_values() function The array_values() function returns an array of all the values ​​in an array. It does not preserve the keys of the original array. $array=[&quot;foo&quot;=&gt;&quot;bar&quot;,&quot;baz&quot;=&gt;&quot;qux&quot;];$values=array_values($array);//$values ​​will be [&quot;bar&quot;,&quot;qux&quot;]Using a loop can Use a loop to manually get all the values ​​of the array and add them to a new

See all articles