开发者

How can you use $this reffering to the controller in a codeIgniter model

I am using CodeIgniter, and in one of my models I would like to refer the $this which is used in $this->load->model and $thi开发者_StackOverflow社区s->load->view, instead of the $this which refers to the object itself.

Is it possible?

Thanks,

Lemiant


You won't be able to use $this to refer to anything but the model object itself, meaning you won't be able to do $this = ....

But you can get the controller instance using the following function:

$controller = &get_instance();

As aularon reminded though, if your application is designed such that you have to access your controller from a model, then perhaps you might want to rethink its implementation.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜