视图层

<td><span class='num'  ><?php echo $value['attr_value']?></span></td>

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

js代码

<script src="../web/js/jquery-1.4.4.min.js"></script>
<script type="text/javascript">
    $(function(){    
    $(document).on('click','.num',function(){    
        var id=$(this).attr('id');    
        var _this=$(this);    
        var new_val=$(this).html();    
        _this.parent().html("<input type='text' class='asdf' value="+new_val+" );      
                }      
            })    
        })    
    })   

</script>

/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

控制器

public function actionUpdategoods(){
   
        $request = Yii::$app->request;       
        $id = $request->get('old_id'); 
        $name = $request->get('old_val'); 
        $connection=Yii::$app->db; 
        $command = $connection->createCommand("
                                            UPDATE ecs_goods_attr SET attr_value='$name' WHERE attr_id='18' AND goods_attr_id='$id'
                                            "); 
        $re=$command->execute(); 
        if($re)    
        {    
            echo 1;    
        }
    }

相关文章:

  • 2022-12-23
  • 2021-07-01
  • 2022-12-23
  • 2021-12-14
  • 2022-03-08
  • 2021-11-13
  • 2021-06-22
  • 2021-12-02
猜你喜欢
  • 2022-12-23
  • 2021-10-26
  • 2021-08-05
  • 2021-08-02
  • 2021-09-03
  • 2022-12-23
相关资源
相似解决方案