我有一个控制器,大约有5-6个功能。
class Register extends CI_Controller {
public function index()
{
// some code written
}
public function Add()
{
// Some code written
}
public function xyz()
{
// Some code written
$this->abc();
}
public function abc()
{
// Some code written
}
}在xyz函数中,我想调用abc函数。这是可能的吗?如果是这样的话,怎么叫?
发布于 2013-10-31 16:23:18
有可能,你写的代码是正确的
public function xyz()
{
// Some code written
$this->abc(); //This will call abc()
}编辑:
你有没有正确地尝试过?
class Register extends CI_Controller {
public function xyz()
{
$this->abc();
}
public function abc()
{
echo "I am running!!!";
}
}并调用register/xyz
https://stackoverflow.com/questions/19701317
复制相似问题