|
发表于 2009-1-24 12:45:22
|
显示全部楼层
Model (models/str.php)PHP复制代码
class str extends Model {
function str()
{
parent::Model();
}
function cutstr_GBK($str,$slen,$startdd=0){
//do something e.g
return $str;
}
}
复制代码 Controller (controllers/show.php)PHP复制代码
class show extends Controller {
function show () {
parent ::Controller();
}
function index (){
$this->load->model('str');
$data = array('viewVariable1'=>$this->str->cutstr_GBK('aaaaaa试,。',8));
$this->load->view('myview',$data);
}
}
复制代码 View (views/myview.php)PHP复制代码
htmltag....
切掉<?=$viewVariable1?>JJ
htmltag....
复制代码
运行index.php/show
这样应该看明白了吧~ |
|