<?php
defined('BASEPATH') OR exit('No direct script access allowed');
class Welcome extends CI_Controller {
/**
* Index Page for this controller.
*
* Maps to the following URL
* http://example.com/index.php/welcome
* - or -
* http://example.com/index.php/welcome/index
* - or -
* Since this controller is set as the default controller in
* config/routes.php, it's displayed at http://example.com/
*
* So any other public methods not prefixed with an underscore will
* map to /index.php/welcome/<method_name>
* @see https://codeigniter.com/user_guide/general/urls.html
*/
public function index()
{
$this->load->view('welcome_message');
}
public function aboutus()
{
$this->load->view('aboutus');
}
}
“我想调用aboutus函数来调用'aboutus'视图。” *这应该是网址 - http://localhost/codeIgniter/aboutus
当我调用此网址时,我收到错误为“找不到对象”
我怎样才能调用aboutus函数?
答案 0 :(得分:0)
要调用所需的网址,您必须定义一条路线,该路线会在点击网址时调用所需的功能。并且要删除index.php,您必须在.htaccess中启用重写模块,或者根据您使用的服务器启用。