本文介绍了同一类中的CodeIgniter调用函数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我试图在我的CodeIgniter应用程序中执行以下代码:
I am trying to do this code in my CodeIgniter application :
<?php
class Inventory extends Controller {
function current_stock()
{
//do something
}
function add_stock()
{
//do something-else
****then do function current_stock()*****
}
}
如何在第二个函数中执行另一个函数?
这里
Am I missing a much easier way?
推荐答案
OK, I agree this is a MAJOR goof-up; comes from lack of OOP understanding;
<?php
class Inventory extends Controller {
function current_stock() {
//do something
}
function add_stock() {
//do something-else
$this->current_stock();
// and we called the other method here!
}
}
Just that I didn"t expect it to be so easy
这篇关于同一类中的CodeIgniter调用函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!