用户
 找回密码
 入住 CI 中国社区
搜索
查看: 1905|回复: 4
收起左侧

[已解决] 神奇的事。求解!

[复制链接]
发表于 2011-6-3 15:05:52 | 显示全部楼层 |阅读模式
我用ci 2.02的这个怎么后台数据循环不出来也?前台:
<?php echo "欢迎来到php!"?>
<?php
if (isset($rows)){

foreach ($rows as $item):?>

<?php echo $item?>

<?php endforeach;}?>


controller:
class UserService extends Controller{
     function UserService()
     {
       parent::Controller();
     }
     function index(){
     
$data['rows']=array('meng','zhang','wang');
        $this->load->view('user_view',$data);
     }
}


发表于 2011-6-3 15:35:24 | 显示全部楼层
controller都写错了吧
class UserService extends CI_Controller{
     function UserService()
     {
       parent::__construct();
     }
}
 楼主| 发表于 2011-6-3 16:56:40 | 显示全部楼层
从哪个版本开始变成这种写法的呢?
发表于 2011-6-3 20:59:57 | 显示全部楼层
ci 2.0 开始
 楼主| 发表于 2011-6-7 11:25:49 | 显示全部楼层
哦,谢啦!

本版积分规则