PHP_CodeIgniter _remap重新定义方法
2021-06-18 15:25
阅读:689
标签:方法 定义 .com dex func 访问 var this extends
如果controller定义了_remap方法, 在_remap中重新定义方法
class Test extends CI_Controller{ public function index(){ echo "hello world"; } //index.php/Test/success/id/1aa public function _remap($method,$params){ if($method==‘success‘){ $method .= ‘2‘; return call_user_func_array(array($this, $method), $params); }else{ $this->index(); } } public function success2($id,$key){ var_dump($id); var_dump($key); } }
上例中存在_remap方法, 重新定义success方法, 实现调用success2方法,
注意,不能直接访问方法success2,需要通过success来方法
手册上的说明
PHP_CodeIgniter _remap重新定义方法
标签:方法 定义 .com dex func 访问 var this extends
原文地址:http://www.cnblogs.com/yyf573462811/p/7207405.html
上一篇:JS创建对象几种不同方法具体解释
下一篇:Jsp基本概念
文章来自:搜素材网的编程语言模块,转载请注明文章出处。
文章标题:PHP_CodeIgniter _remap重新定义方法
文章链接:http://soscw.com/index.php/essay/95528.html
文章标题:PHP_CodeIgniter _remap重新定义方法
文章链接:http://soscw.com/index.php/essay/95528.html
评论
亲,登录后才可以留言!