Heim >Backend-Entwicklung >PHP-Tutorial >YII 图片做button CHtml::imageButton_PHP教程

YII 图片做button CHtml::imageButton_PHP教程

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-07-13 17:52:53893Durchsuche

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

www.bkjia.comtruehttp://www.bkjia.com/PHPjc/478091.htmlTechArticleCHtml::imageButton 方法可以用一个图片做button,但是提交的方法不是post, 也有可能是GET,没试过GET。 在view中这样写: ?php if(isset($_GET[id])) {...
Stellungnahme:
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn