我正在 try catch ZEND 更新,以便查看谁修改了哪些内容。 我在ZEND框架源码中找到了功能更新。像这样
public function update($table, array $bind, $where = '')
{
global $Profiling;
try
{
return $this->dbInstance->update($table, $bind,$where);
}
catch (Zend_Exception $e) {
$this->write_log($Profiling,"update " . $table,$e);
}
}
所以我有 table ,我有地方。及一切田野。完美的。 但是,当我对 $bind 变量执行 print_r 时,出现了问题。我显示了所有字段。
Array
(
[mail] => Test_Droit_Utilisateur@osef.com
[lastName] => testlastname
[firstName] => TestFirstName
[v_gender_id] => 2
[active] => 1
[adress] => 56 rue test
)
我不知道到底修改了什么。所有数据均通过版本页面上的表格发布。例如,当我仅修改邮件时,print_r 将显示 $bind 变量中的所有信息。不可能知道真正修改了什么。 我想我可以在字段上花一些时间,并将每个字段值与这个 $bind 变量进行比较。但效率不是很高,因为在几个表上,我有很多字段。
如果有人能帮我找到解决方案。我已经准备好了 :) 谢谢大家的建议。
最佳答案
您可以使用
array_diff_assoc($bind,$valuesfromDatabase);
关于php - 使用 Zend 获取更新时修改的字段,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16189221/