我正在尝试将一个字段复制到另一个字段。一个是称为成员的相关字段,另一个称为名称。
我相信用 Logic Hooks 做到这一点是最好的方法。所以下面是我的 logic_hooks.php
<?php
// Do not store anything in this file that is not part of the array or the hook version. This file will
// be automatically rebuilt in the future.
$hook_version = 1;
$hook_array = Array();
// position, file, function
$hook_array['before_save'] = Array();
$hook_array['before_save'][] = Array(1, 'Value from one field to another', 'custom/modules/ship_Membership/my.php', 'User_hook','copy');
?>
这是 my.php
class User_hook {
function copy(&$bean, $event, $arguments)
{
$bean->name = $bean->member;
}
}
这是我在保存时遇到的错误
class User_hook { function copy(&$bean, $event, $arguments) { $bean->name = $bean->member; } }