this is my link
这是我的链接
href="<?php echo base_url();?>views/contact"
controller code here
控制器代码在这里
class S extends CI_Controller {
public function index()
{
$this->load->view('header');
$this->load->view('banner');
$this->load->view('content');
$this->load->view('footer');
}
public function contact()
{
$this->load->view('contact');
}
}
my output :
我的输出:
404 Page Not Found The page you requested was not found.
找不到404页面未找到您请求的页面。
plese help me....
请帮助我....
3 个解决方案
#1
1
href should be controller name and function name not view folder name
href应该是控制器名称和函数名称而不是查看文件夹名称
try this
尝试这个
href="<?php echo base_url();?>s/contact"
#2
0
Did you declare the route in the config/route.php file ? See this link to description
你在config / route.php文件中声明了路由吗?请参阅此说明链接
#3
0
to make custom route for a page you can add the route of page and the controller action in config/route.php as follows
要为页面创建自定义路由,您可以在config / route.php中添加页面路由和控制器操作,如下所示
$route['contact'] = 's/contact';
then you can request the page from any place as the following by using site_url() method
然后,您可以使用site_url()方法从任何地方请求页面,如下所示
<a href="site_url('contact')">Contact</a>
note you need to load url helper to use this method you can autoload it in config/autoload.php
请注意,您需要加载url helper才能使用此方法,您可以在config / autoload.php中自动加载它
I hope my answer would be useful
我希望我的回答很有用
#1
1
href should be controller name and function name not view folder name
href应该是控制器名称和函数名称而不是查看文件夹名称
try this
尝试这个
href="<?php echo base_url();?>s/contact"
#2
0
Did you declare the route in the config/route.php file ? See this link to description
你在config / route.php文件中声明了路由吗?请参阅此说明链接
#3
0
to make custom route for a page you can add the route of page and the controller action in config/route.php as follows
要为页面创建自定义路由,您可以在config / route.php中添加页面路由和控制器操作,如下所示
$route['contact'] = 's/contact';
then you can request the page from any place as the following by using site_url() method
然后,您可以使用site_url()方法从任何地方请求页面,如下所示
<a href="site_url('contact')">Contact</a>
note you need to load url helper to use this method you can autoload it in config/autoload.php
请注意,您需要加载url helper才能使用此方法,您可以在config / autoload.php中自动加载它
I hope my answer would be useful
我希望我的回答很有用