且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

错误400删除记录的无效请求YII

更新时间:2022-06-27 07:06:04

之所以发生这种情况,是因为它不是发布请求. CHtml::link提供了一种使用post方法而不是get的方法.这要求您在clientChangesubmit属性>.

This is happening because it's not a post request. CHtml::link has a way by which you can use post method, instead of get. This requires you to use submit attribute of clientChange, in your htmlOptions.

有点像:

echo CHtml::link(CHtml::encode('Delete image'), array('image/delete', 'id'=>$image->id),
  array(
    'submit'=>array('image/delete', 'id'=>$image->id),
    'class' => 'delete','confirm'=>'This will remove the image. Are you sure?'
  )
);