Rumah > Soal Jawab > teks badan
<!doctype html>
<html>
<head>
<meta charset="UTF-8">
<title>箜
< pautan rel="stylesheet" type="text/css" href="__PUBLIC__/css/common.css"/> <link rel="stylesheet" type="text/css" href="__PUBLIC__/css /main.css"/> <script type="text/javascript" src="__PUBLIC__/js/libs/modernizr.min.js"></script> <script type=" text/javascript" src="__PUBLIC__/ueditor/ueditor.config.js"></script> <script type="text/javascript" src="__PUBLIC__/ueditor/ueditor.all.min.js "></script> <script type="text/javascript" src="__PUBLIC__/ueditor/lang/zh-cn/zh-cn.js"></script>< /head><body> <include file="Public/head" /> <div class="container clearfix"> <include file=""Public/left > <div class="main-wrap"> <div class="crumb-wrap"> <div class="gt;<. icon-font"></i><a href="/jscss/admin/design/">首页</a><span class="crumb-step">>< /span><a class="crumb-name" href="/jscss/admin/design/">文章管理</a><span class="crumb-step">></ span><span>新增文章</span></div> </div><div class="result-wrap">
<div class="result-content">
i=form name="d" nama borang saya "myform" enctype="multipart/form-data">
<input type="hidden" name="id" value="{$article.id}">
; jadual dalam & lt -tab" width="100%">
<th><i class="require-red">*</i>文章名称: </th>
<td>
<td>
lt " value="{$articler.title}" jenis ="teks">
</td>
</td> <tr>
<th><i class="require-red">*</i>文章描述:</th>
<td>
<td>
; 0px;tinggi:100px;" name="desc">{$article.desc}</textarea>
</td>
; ;
<tr><th><i class="require-red">*</i>缩略图:</th>
<td> <input id="pic" name=" pic" size="50" value="" type="file"> <if condition="$article ['pic'] neq ''"> <img src="__ROOT__{$ articler.pic} "ketinggian =" 50 "& gt; & lt; else/& gt; 暂 无 图片 & lt;/if & gt; & lt;/td & gt; & lt;/tr & gt; & lt; tr> <th><i class="require-red">*</i>所属栏目:< <td> <pilih nama="cateid" > ;volist name="cateres" id="vo"><option <if condition="$vo['id'] eq $article['cateid']">selected="selected"</if> value="{$vo.id}">{$vo.catename}</option>
< </select>
</td>
;/tr
章内容:</th>
<td>
<textarea name="content" id="content" >{$article.content}</textarea>
</td>
;/tr> <tr> < th></th> <td> <td> ; b tn6 mr10" value="提交" type="submit"> <input class="btn btn6 " onclick="history.go(-1)" value="返回" type="button"> </td>.
</div> </div> </div> < !--/main--></div><script type="text/javascript"> UE.getEditor('content',{initialFrameWidth:1000,initialFrameHeight:2000,} );</skrip></body></html>Duke2018-05-20 09:23:31
<?php
ruang nama AdminController;
gunakan ThinkController;
class ArticleController memanjangkan Pengawal {
Public function lst(){
$count= $article->ery the total bilangan rekod yang memenuhi keperluan $Page= new ThinkPage($count,5);// Instantiate kelas paging dan lulus dalam jumlah bilangan rekod dan paparan pada setiap halaman Bilangan rekod (25) $show = $Page->show();// Paparkan output dalam paging $list = $article->order('id desc')->limit($Page- >firstRow.','.$ Halaman->listRows)->select(); $this->assign('list',$list);// Berikan set data $this-> ;assign('page',$show );//Tetapkan output paging _POST){ $tarikh['tajuk']=Saya('tajuk'); $tarikh['kandungan']= I('content'); $ date['desc']=I('desc'); $date['cateid']=I('cateid'); '){ off ' , ' gif', 'png', 'jpeg'); // Tetapkan jenis muat naik lampiran $upload->rootPath= './'; // Tetapkan direktori akar muat naik lampiran $save Path '/Awam/Muat Naik/'; // Tetapkan direktori muat naik lampiran (sub) $ info) {// Muat naik mesej ralat gesaan ralat $ ini-& gt; ralat ($ muat naik- & gt; geterror ()); ']=$info['savepath'].$info['savename'];
if($article->create($date)){
if($article->add()){
$this->suc st') );
}lain{
$this->error('添加文章失败!');
$this->error($article->getError()) ; $ini ->paparan();
}
edit fungsi awam(){
//实例化
$article=D('article');
) (IS POS tarikh['tajuk ']=I('title'); $date['content']=I('content'); $date['desc']=I('desc'); $date[' cateid']=I('cateid'); if($_FILES['pic']['tmp_name']!=''){ $upload = new ThinkUpload();// 实例化上䎼.附件上传类型 $upload->rootPath= './'; // 设置附件上传根目录 $upload->savePath ='/Public/Uploads/'; // 设置附件上传(子)目录 // 上传单个文件 // 上传单个文件 $info = $FILEif(!$info) {// 上传错误提示错误信息
$this->error($upload->getError());
}else件信息
$date['pic']=$info['savepath '].$info['savename'];
}
}lain{
}if($article->create($date)){
if($article->save()){
$this->suc ') );
}lain{
$this->error('修改文章失败!');
$this->error($article->getError()) ; ler);
$cateres=D('cates')->select();
$this->assign('cateres',$cateres);
$this->display();
}
}
fungsi awam del(){ //实例化 $article=D('article'); if($article->delete(I('id ) ) ) ->success('删除文章成功!',U('lst')); }lain{
$this->error('删除文玜! 喇玠!' );