PHP Classes

File: codeigniter/get_ci_controller_method_name.php

Recommend this page to a friend!
  Classes of Kabir Hossain   PHP CodeIgniter Tips Tricks   codeigniter/get_ci_controller_method_name.php   Download  
File: codeigniter/get_ci_controller_method_name.php
Role: Auxiliary script
Content type: text/plain
Description: Configuration script
Class: PHP CodeIgniter Tips Tricks
Collection of tips and examples to use CodeIgniter
Author: By
Last change:
Date: 1 month ago
Size: 510 bytes
 

Contents

Class file image Download
//You could use the URI Class:

$this->uri->segment(n); // n=1 for controller, n=2 for method, etc

//I've also been told that the following work, but am currently unable to test:

$this->router->fetch_class();
$this->router->fetch_method();

$ci =& get_instance();
$ci->router->fetch_class();

//There's also a
$ci->router->fetch_method();
//method if you need the name of the method called for any reason.
//sanitize file name
$filename = $this->security->sanitize_filename($this->input->post('filename'));