3 回答

TA貢獻(xiàn)1797條經(jīng)驗(yàn) 獲得超4個贊
class Gc_script
{
public $CI;
public function __construct()
{
$this->CI =& get_instance();
$this->CI->config->item('base_url');
}
public function getGrocreyCrud($table_name, $read=null)
{
$crud = new grocery_Crud();
$crud->set_table($table_name);
$crud->set_subject(ucwords(str_replace('_', ' ', $table_name)));
$crud->callback_delete(function ($primary_key) use ($table_name) {
return $this->CI->db->update($table_name, array('flag'=>'0'), array('id'=>$primary_key));
});
return $crud;
}
}

TA貢獻(xiàn)1806條經(jīng)驗(yàn) 獲得超8個贊
可能以下應(yīng)該工作
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
if(!function_exists('getCrud'))
{
function getCrud($table_name, $subject)
{
// some code
}
}
if(!function_exists('oneToMany'))
{
function oneToMany()
{
$CI =&get_instance();
$crud = getCrud($table_name, $subject);
return $crud ;
}
}

TA貢獻(xiàn)1776條經(jīng)驗(yàn) 獲得超12個贊
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
function getCrud($table_name, $subject)
{
// some code
}
function oneToMany()
{
$CI =&get_instance();
$crud = $CI->getCrud($table_name, $subject);
return $crud ;
}
試試這個
- 3 回答
- 0 關(guān)注
- 131 瀏覽
添加回答
舉報