YiiÊý¾Ý¶ÁÈ¡ÓëÌøת²ÎÊý´«µÝÓ÷¨ÊµÀý·ÖÎö

5年以前  |  阅读数:875 次  |  编程语言:PHP 

±¾ÎÄʵÀý½²ÊoÁËYiiÊý¾Ý¶ÁÈ¡ÓeÌøת²ÎÊý´«µÝÓè¡£ÖÏi¸ø´o¼Ò¹(C)´o¼Ò²Î¿¼£¬¾ßÌaÈçÏ£º


    $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=$command->query();
    //$rows=$dataReader->readAll();
    while(($row=$dataReader->read())!==false) {
      var_dump($row);
    }
    $this->render('index',array('toop'=>$toop,'var1'=>$test,'var2'=>$te));

$rowµÄ½a¹uÊÇ£º


    array (size=4)
     'id' => string '1' (length=1)
     'username' => string 'test1' (length=5)
     'password' => string 'pass1' (length=5)
     'email' => string 'test1@example.com' (length=17)
    array (size=4)
     'id' => string '2' (length=1)
     'username' => string 'test2' (length=5)
     'password' => string 'pass2' (length=5)
     'email' => string 'test2@example.com' (length=17)
    array (size=4)
     'id' => string '3' (length=1)
     'username' => string 'test3' (length=5)
     'password' => string 'pass3' (length=5)
     'email' => string 'test3@example.com' (length=17)

$rowsµÄ½a¹u£º


    array (size=21)
     0 =>
      array (size=4)
       'id' => string '1' (length=1)
       'username' => string 'test1' (length=5)
       'password' => string 'pass1' (length=5)
       'email' => string 'test1@example.com' (length=17)
     1 =>
      array (size=4)
       'id' => string '2' (length=1)
       'username' => string 'test2' (length=5)
       'password' => string 'pass2' (length=5)
       'email' => string 'test2@example.com' (length=17)
     2 =>
      array (size=4)
       'id' => string '3' (length=1)
       'username' => string 'test3' (length=5)
       'password' => string 'pass3' (length=5)
       'email' => string 'test3@example.com' (length=17)
     3 =>
      array (size=4)
       'id' => string '4' (length=1)
       'username' => string 'test4' (length=5)
       'password' => string 'pass4' (length=5)
       'email' => string 'test4@example.com' (length=17)

$dataReader->read() Óe $dataReader->readAll() ²»ÄÜͬʱʹÓà µ±$dataReader->read()¶ÁÍeÖ®ºo$dataReader->readAll()¶ÁÈ¡µÄΪ¿Õ£¬*´Ö®Ò»Ñu¡£

ͨ¹ýrender´«µÝµÄ²ÎÊý¿ÉÒÔÕaÑuµ÷Óãº


    <?php
    var_dump($toop);
    var_dump($var1);
    var_dump($var2);
    ?>

¸u¶a¹ØÓÚYiiÏa¹ØÄÚÈݸÐÐËȤµÄ¶ÁÕ߿ɲe¿´±¾Õ¾×¨Ìa£º¡¶Yii¿o¼ÜÈeÃż°³£Óü¼ÇÉ×ܽa¡¡¢¡¶[phpÓÅÐa¿ª¢¿o¼Ü×ܽa](http://www.jb51.net/Special/155.htm)¡¡¢¡¶smartyÄ£°aÈeÃÅ»u´¡½Ì³Ì¡¡¢¡¶phpÈÕÆÚÓeʱ¼aÓÃ*¨×ܽa¡¡¢¡¶phpÃaeÏo¶ÔÏo³ÌÐoÉe¼ÆÈeÃŽ̡̳¡¢¡¶php×Öu´®(string)Óè×ܽa¡¡¢¡¶php+mysqlÊý¾Ý¿a²Ù×÷ÈeÃŽ̡̳¼°¡¶php³£¼uÊý¾Ý¿a²Ù×÷¼¼ÇÉ»a×Ü¡*

Ï£Íu±¾ÎÄËuÊo¶Ô´o¼Ò»uÓÚYii¿o¼ÜµÄPHP³ÌÐoÉe¼ÆÓÐËu°iÖu¡£

 相关文章:
PHP分页显示制作详细讲解
SSH 登录失败:Host key verification failed
获取IMSI
将二进制数据转为16进制以便显示
获取IMEI
文件下载
贪吃蛇
双位运算符
PHP自定义函数获取搜索引擎来源关键字的方法
Java生成UUID
发送邮件
年的日历图
提取后缀名
在Zeus Web Server中安装PHP语言支持
让你成为最历害的git提交人
Yii2汉字转拼音类的实例代码
再谈PHP中单双引号的区别详解
指定应用ID以获取对应的应用名称
Python 2与Python 3版本和编码的对比
php封装的page分页类完整实例