欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

Yii框架獲取當(dāng)前controlle和action對(duì)應(yīng)id的方法

 更新時(shí)間:2014年12月03日 10:06:42   投稿:shichen2014  
這篇文章主要介紹了Yii框架獲取當(dāng)前controlle和action對(duì)應(yīng)id的方法,可實(shí)現(xiàn)獲取當(dāng)前controlle或action對(duì)應(yīng)id的功能,是非常實(shí)用的技巧,需要的朋友可以參考下

本文實(shí)例講述了Yii框架獲取當(dāng)前controlle和action對(duì)應(yīng)id的方法。分享給大家供大家參考。具體方法如下:

在Yiii框架開(kāi)發(fā)中,你可能會(huì)要獲取當(dāng)前controlle或action的id,其實(shí)很簡(jiǎn)單,一句代碼就實(shí)現(xiàn)了,以下是分別在controlle(控制器)和View(視圖)中獲取當(dāng)前id的代碼。

在控制器里:

復(fù)制代碼 代碼如下:
$name = $this->getId();  // controller

$name = $action->id;  // action


在視圖里:
復(fù)制代碼 代碼如下:
$name = Yii::app()->controller->id;  // controller

$name = $this->getAction()->getId(); // action

希望本文所述對(duì)大家基于yii框架的PHP程序設(shè)計(jì)有所幫助。

相關(guān)文章

最新評(píng)論