Home > Backend Development > PHP Tutorial > CI 框架下controller里面action可以互调吗?

CI 框架下controller里面action可以互调吗?

WBOY
Release: 2016-06-06 20:50:15
Original
1557 people have browsed it

rt 同一个controller下不同的action之间可以互相传参调用吗? 该怎么调用

回复内容:

rt 同一个controller下不同的action之间可以互相传参调用吗? 该怎么调用

可以啊, 就和同一个类调用内部方法一样.

<code class="lang-php">function index() {
     $this->page(0);
}
function list($pageNo = 0) {
}
</code>
Copy after login

可以。

<code>function index()
{
    $this->user('5'); //直接调用本controlller下的另一个function
}
function user($uid)
{
    ......
}
</code>
Copy after login

没这么用过, 如果你是想在一个控制器中调用一个辅助性的函数,可以把那个函数设置成

<code>private function _somefun(){
    do someting...
}
</code>
Copy after login

这样就不会作为一个外部访问的控制器动作了。

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template