我试图在我的Codeigniter应用程序中执行此代码
<?php
class Inventory extends Controller {
function current_stock()
{
//do something
}
function add_stock()
{
//do something-else
****then do function current_stock()*****
}
}
Run Code Online (Sandbox Code Playgroud)
如何从第二个函数中执行另一个函数.这里概述的方法(关于扩展控制器)对我来说是一种过度杀伤力.
我错过了一个更简单的方法吗?
Mr *_*yde 101
好的,我同意这是一个主要的蠢事; 来自缺乏OOP理解;
<?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!
}
}
Run Code Online (Sandbox Code Playgroud)
只是我没想到它会那么容易
| 归档时间: |
|
| 查看次数: |
82446 次 |
| 最近记录: |