如何使用 Yii 创建带有确认对话框的链接?

2022-01-04 00:00:00 php yii

如何在 Yii 框架中创建带有确认对话框的链接?

How can I create a link with a confirmation dialog in Yii framework?

假设我有

CHtml::link('Delete',array('wsrecruiteducation/delete','id'=>$model->EducID));

如何在删除数据之前将上面的代码片段转换为带有确认警报的删除链接?

how do I convert that code snippet above, into a delete link with a confirm alert before deleting the data?

推荐答案

你只需要同时使用CHtml::link的最后一个参数:

You just need to also use the last parameter of CHtml::link:

CHtml::link(
    'Delete',
     array('wsrecruiteducation/delete','id'=>$model->EducID),
     array('confirm' => 'Are you sure?')
);

相关文章