Home > php教程 > PHP开发 > body text

CI Framework Notes 5

黄舟
Release: 2016-12-29 09:41:55
Original
1112 people have browsed it

<?php
echo base_url();
echo base_url().&#39;index&#39;;
public function article(){
}
echo site_url().&#39;style/index&#39;;
class Admin extends CI_Controller {
public function index(){
$this->load->view(&#39;admin/index.html&#39;);
}
//默认欢迎
public function copy(){
$this->load->view(&#39;login/index.html&#39;);
}
//发表模板显示
public function send_article(){
//载入辅助函数
$this->load->helper(&#39;&#39;);
$this->load->view(&#39;aricle/article.html&#39;);
}
//发表文章的动作
public function send(){
//载入表单验证类
$this->load->library(&#39;form_validation&#39;);
//设置验证规则
$this->form_validation->set_rules(&#39;title&#39;,&#39;文章标题&#39;,&#39;require|min_length[5]&#39;);
$this->form_validation->set_rules(&#39;type&#39;,&#39;类型&#39;,&#39;require|integer&#39;);
$this->form_vadition
//执行验证
$status = $this->form_validation->run();
if($status){
echo &#39;数据库操作&#39;;
}else{
$this->load->helper(&#39;form&#39;);
$this->load->view(&#39;admin\article.html&#39;);
}
}
/**
*编辑文章
*/
public function edit_article{
$this->load->helper(&#39;form&#39;);
$this->load->view(&#39;&#39;);
}
//编辑动作
public function edit(){
$this->load->library(&#39;form_validation&#39;);
$status = $this->form_validation->run(&#39;article&#39;);
}
}
?>
<?php
echo base_url().&#39;/style/admin/css/public.css&#39;;
?>
<?php
echo site_url(&#39;&#39;);
/**
*在模板上输出设定的值
*/
<input type="text" name="cname" value="<?php echo set_value(&#39;cname&#39;)?>" />
?>
<?php
<form action="<?php site_url(&#39;admin/category/add&#39;)?>"></form>
?>
Copy after login

The above is the content of CI Framework Note 5. For more related content, please pay attention to the PHP Chinese website (www.php.cn)!


Related labels:
source:php.cn
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
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template