How to call controller function from view in codeigniter?

后端 未结 4 1511
陌清茗
陌清茗 2021-01-16 20:17

With codeigniter, I have a controller as in the following:



        
4条回答
  •  爱一瞬间的悲伤
    2021-01-16 20:29

    if You Want to call controller function like this /CodeIgniter/myController/myFn then, You have to remove index.php file using .htaccess file. First You change config.php file like this.

    //  Remove index.php
    
    $config['index_page'] = ""
    

    then, create .htaccess file and copy this code to that file.

    
    RewriteEngine On
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ index.php/$1 [L]
    
    

    Then, put this .htaccess file inside codeignator project folder.

    To Reference see this link:- enter link description here

提交回复
热议问题