当前位置:Gxlcms > PHP教程 > TP里面insert()和update()都调用了D函数。可是为什么update的D函数没有生效?

TP里面insert()和update()都调用了D函数。可是为什么update的D函数没有生效?

时间:2021-07-01 10:21:17 帮助过:23人阅读

    public function insert()
    {
        $m = D($this->table);
        if(!$vo = $m->create())
        {
            $this->error($m->getError());
        }
        else
        {
          dump($vo);

  public function update()
    {
        $Form = D($this->table);
        if ($vo = $Form->create())
        {
            dump($vo);
//这是Model里面的
protected $_auto = array(
  array('prof', 'con', 1, 'callback'),
);



update的时候auto得不到调用。而insert就没有问题。我也是晕了。为什么会这样??

回复内容:

    public function insert()
    {
        $m = D($this->table);
        if(!$vo = $m->create())
        {
            $this->error($m->getError());
        }
        else
        {
          dump($vo);

  public function update()
    {
        $Form = D($this->table);
        if ($vo = $Form->create())
        {
            dump($vo);
//这是Model里面的
protected $_auto = array(
  array('prof', 'con', 1, 'callback'),
);



update的时候auto得不到调用。而insert就没有问题。我也是晕了。为什么会这样??

抱歉。我不该问这么弱智的问题。。查了下文档。没写填充时间。

人气教程排行