Yii資料讀取與跳轉引數傳遞用法例項分析

2022-10-06 03:06:07 字數 2323 閱讀 2771

$toop=array('id'=>'aaaa','name'=>'bbbb','nickname'=>'ccccc','phone'=>'ddddd','status'=>'eeeeee','mytest'=>$te);

$test='hello world!';

$te="\$this->test='qweqw'";

$conn=yii::app()->db;

$sql="select * from tbl_user";

$command=$conn->createcommand($sql);

$datareader=$comm程式設計客棧and->query();

//$rows=$datareader->readall();

while(($row=$datareader->read())!==false)

$this->render('index',array('toop'=>$toop,'var1'=>$test,'var2'=>$te));

$row的結果是:

array (size=4)

'id' => string '1' (length=1)

'username' => string 'test1' (length=5)

'password' => string 'pass1' (length=5)

'email' => string '[email protected]' (length=17)

array (size=4)

'id' => string '2' (length=1)

'username' => string 'test2' (length=5)

'password' => string 'pass2' (length=5)

'email' =>程式設計客棧 string '[email protected]' (length=17)

array (size=4)

'id' => string '3' (length=1)

'username' => string 'test3' (length=5)

'password' => string 'pass3' (length=5)

'email' => string '[email protected]' (length=17)

$rows的結果:

array (size=21)

0 =>

array (size=gijjlgueh4)

'id' => string '1' (length=1)

'username' => string 'test1' (length=5)

'password' => string 'pass1' (length=5)

'email' => string '[email protected]' (length=17)

1 =>

array (size=4)

'id' => string '2' (length=1)

'username' => string 'test2' (length=5)

'password' => string 'pass2' (length=5)

'email' => string '[email protected]' (length=17)

2 =>

array (size=4)

'id' => string '3' (length=1)

'username' > string 'test3' (leng程式設計客棧th=5)

'password' => string 'pass3' (length=5)

'email' => string '[email protected]' (length=17)

3 =>

array (size=4)

'id' => string '4' (length=1)

'username' => string 'test4' (length=5)

'password' => string 'pass4' (length=5)

'email' => string '[email protected]' (length=17)

$datareader->read() 與 $datareader->readall() 不能同時使用 當$datareader->read()讀完之後$datareader->readall()讀取的為空,反之一樣。

通過render傳遞的引數可以這樣呼叫:

phpvar_dump($toop);

var_dump($var1);

var_dump($var2);

?>

Vue 頁面跳轉與引數傳遞

1 不帶引數跳轉 about button router link button router link 2 帶引數跳轉 button router link button router link 3.接收引數 以query方式接收引數 query傳遞資料是通過url傳遞的,類似ajax中的get方...

Vue 頁面跳轉方式 與 引數傳遞

要清楚的是 vue中都是單頁面應用居多,而所謂的頁面跳轉,也是通過路由重新渲染了一下檢視,而不是真正的頁面跳轉。about router link to router link template strong p to router link to router link template temp...

頁面跳轉與資料傳遞

建立第二個activity activity的跳轉 activity的跳轉需要建立intent物件,通過設定intent物件的引數指定要跳轉activity 通過設定activity的包名和類名實現跳轉,稱為顯式意圖 通過指定動作實現跳轉,稱為隱式意圖 顯式意圖 隱式意圖 隱式意圖啟動activit...