Home > php教程 > php手册 > YII 图片做button CHtml::imageButton

YII 图片做button CHtml::imageButton

WBOY
Release: 2016-06-13 10:50:57
Original
1261 people have browsed it

CHtml::imageButton 方法可以用一个图片做button,但是提交的方法不是post,

也有可能是GET,没试过GET。

在view中这样写:

if(isset($_GET['id']))
{
echo CHtml::imageButton(Yii::app()->baseUrl.'/images/button1.png',array('submit' => 'action1?id='.$_GET['id']) );    // 带参数的
        echo CHtml::imageButton(Yii::app()->baseUrl.'/images/button2.png',array('submit' => 'controller2/action2'));                         //  不带参数的

}

?>

这样可以提交。

但是在controller的action里面

得不到POST  www.2cto.com

if(isset($_POST['Post']))
{

//  NEVER COME HERE

}


 

作者:georgelife7
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template