受信データを取得してクレンジングし、データに応じて INSERT または UPDATE を実行する関数があります。私が必要としているのは、関数を呼び出すたびにカスタム データ テスト ロジックを関数の途中に渡す機能です。このような素晴らしいウェブサイトからの助けに感謝します。
$tests = 'if($data[0] == '-') $data[0] = NULL';
$this->run_function($data, $table, $message, $tests);
public run_function($data, $table, $message, $tests){
if(isset($data['submit'])) unset($data['submit']);
//Other array manipulation here
echo $tests
//Pass custom testing on $data array here.
$this->db->update($data,$table);
// ETC.
}
基本的に、私は通常、関数にパラメーターを追加しますが、渡そうとするのがphpロジックの場合は機能しません。これを回避するためのアイデアはありますか?