页面未被识别?

时间:2014-05-08 16:34:29

标签: php codeigniter view model

当我尝试在浏览器中加载时,控制器似乎没有识别我的视图页面。视图页面本身称为insertjob.php,控制器称为客户端,因此链接应为website_url/client/insertjob

我已将其上传到服务器并且主页正常工作,但即使链接正确,也不会加载插入作业页面。

控制器

public function addjobsform()
{
$this->load->helper('form');
$data['title']="Add a new job";
$this->load->view("insertjob", $data);
}

查看

<h1>Welcome to XYZ inc.</h1> 
<p>Find out everything you need to know about the XYZ company</p> 

<div id="nav"
<ul> 
<li><a href="<?php echo site_url('nav/home');?>">Home</a><li>
<li><a href="<?php echo site_url('client/insertjob');?>">Insert</a></li>
</ul>

模型

<?php

class cmodel extends CI_Model {

function __construct()
{
parent:: __construct();   
}

function getjob(){
$query = $this->db->get('client');
return $query->result();
}

}
function addjob($jobtype,$jobinfo)
{
    $newjob=array("jobtype"=>$jobtype,"jobinfo"=>$jobinfo);
    return $this->db->insert('client', $newjob);
}

}
?>

1 个答案:

答案 0 :(得分:1)

您使用了错误的网址

website_url/index.php/client/addjobsform

website_url/index.php/controller/controllerfunction