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

YII 图片做button CHtml::imageButton

WBOY
WBOYOriginal
2016-06-13 10:50:571256browse

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
Statement:
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
Previous article:php_server详解Next article:PHP设计模式系列