Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/265.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/codeigniter/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何在welcome_message.php中的codeigniter中创建函数_Php_Codeigniter - Fatal编程技术网

如何在welcome_message.php中的codeigniter中创建函数

如何在welcome_message.php中的codeigniter中创建函数,php,codeigniter,Php,Codeigniter,要调用所需的url,您必须定义一个路由,该路由将在点击url时调用所需的函数。要删除index.php,您必须在.htaccess中启用重写模块,或者根据您使用的服务器而定。为此使用路由,或者创建名为aboutus的控制器,这是当前的url,工作正常,但是我想删除index.php,这样我就可以得到url了。为此,我应该怎么做?看看这个codeigniter uri routes@Deepakdev-如果您的问题是如何删除index.php,那么您应该编辑您的问题,因为您在其中没有提到这一点。或

要调用所需的url,您必须定义一个路由,该路由将在点击url时调用所需的函数。要删除index.php,您必须在.htaccess中启用重写模块,或者根据您使用的服务器而定。

为此使用路由,或者创建名为aboutus的控制器,这是当前的url,工作正常,但是我想删除index.php,这样我就可以得到url了。为此,我应该怎么做?看看这个codeigniter uri routes@Deepakdev-如果您的问题是如何删除index.php,那么您应该编辑您的问题,因为您在其中没有提到这一点。或者更好的是,使用谷歌(或CI的手册),因为这已经被询问和回答了不止一次。
<?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');
    }
}