想要输出在视图中格式化的数据 [英] want to output data formated in view
本文介绍了想要输出在视图中格式化的数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
嗨2我想显示使用css设计的表格我是新来的codeigniter
model
<?php
if(!defined('BASEPATH'))exit('不允许直接脚本访问') ;
class User_Model extends CI_Model
{
function __construct()
{
parent :: __ construct();
}
函数entry_insert($ data)
{
$ this-> db-> insert ( '申请人',$数据);
}
函数get_entery($ title)
{
返回$ this-> db-> where('postiontitle',$ title) - > get('applicants') - > result();
}
}
查看
< html >
< head >
< link rel = stylesheet type = text / css href = ./ assets / main.css / >
< / head >
< body >
< div id = main_container >
< < span class =code-leadattribute> / div >
< ; / body >
< / html >
控制器
<? php
class Adminc extends CI_Controller
{
function __ construct()
{
parent :: __ construct();
$ this - > load-> database();
$ this-> load-> model('User_Model',user);
}
公共职能指数()
{
$ this-> load-> view('admin');
$ title =android developer;
$ users = $ this-> user-> get_entery($ title);
// var_dump($ users);
foreach($ users as $ user)
{
echo< 表 > ;
echo< tr > < /跨度>;
echo< td > 。$ user-> fullname。< / td < span class =code-keyword>> ;
echo< td > \".$user->age.\"< / td > 跨度>;
echo< td > \".$user->phonenumber.\"< / td > 跨度>;
echo< td > \".$user->expectedsalary.\"< / td > 跨度>;
echo< td > \".$user->email.\"< / td > 跨度>;
echo< td < span class =code-keyword>> 。$ user-> experence。< / td > ;
echo< td > 。$ user-> testquestion。< / td < span class =code-keyword>> ;
echo< td > \".$user->answer.\"< / td > 跨度>;
echo< / tr > 跨度>;
echo< / table > 跨度>;
}
}
}
?>
解决方案
数据)
{
this-> db-> insert('applicants',
数据);
}
函数get_entery(
hi 2 all i want to display the tabel styled using css i'm new to codeigniter
model
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); class User_Model extends CI_Model { function __construct() { parent::__construct(); } function entry_insert($data) { $this->db->insert('applicants',$data); } function get_entery($title) { return $this->db->where('postiontitle', $title)->get('applicants')->result(); } }
view
<html>
<head>
<link rel="stylesheet" type="text/css" href="./assets/main.css"/>
</head>
<body>
<div id="main_container">
</div>
</body>
</html>
controller
<?php
class Adminc extends CI_Controller
{
function __construct()
{
parent::__construct();
$this->load->database();
$this->load->model('User_Model' , "user");
}
public function index( )
{
$this->load->view('admin');
$title="android developer";
$users = $this->user->get_entery($title);
//var_dump($users);
foreach ($users as $user)
{
echo"<table>";
echo"<tr>";
echo"<td>".$user->fullname."</td>";
echo"<td>".$user->age."</td>";
echo"<td>".$user->phonenumber."</td>";
echo"<td>".$user->expectedsalary."</td>";
echo"<td>".$user->email."</td>";
echo"<td>".$user->experence."</td>";
echo"<td>".$user->testquestion."</td>";
echo"<td>".$user->answer."</td>";
echo"</tr>";
echo"</table>";
}
}
}
?>
解决方案
data) {
this->db->insert('applicants',
data); } function get_entery(
这篇关于想要输出在视图中格式化的数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文