按理说onAfterWrite
和 onAfterInsert
这个事件 的参数应该是入库后的数据【包含id】,就像ThinkPHP5
的 afterWrite
和 afterInsert
一样 都能得到 id。
// tp6
//写入后
public static function onAfterWrite($row)
{
print_r($row->toArray());
}
结果
// tp5
protected static function init()
{
// 写入后
self::afterWrite(function ($row)
{
print_r($row->toArray());
}
}
tp6 如何实现 如 tp5 一样 更新后 等得到 id 索引呢??