15 12 2015

今天学习了一下thinkphp 3.2.3的使用实例化封装的自定义类


<?php
namespace Home\Controller;
use Home\Controller\Common\PublicController;
use Common\ORG\SystemUtil;    //主要是这里要use

/**
** 默认控制器
**/
class IndexController extends PublicController {
    public function index(){
   
    $system=new SystemUtil();
    echo $system->get_success();die;
   
    $this->assign("title",'"一键车险" 最贴心的车辆保险专家');
$this->display();
    }
}


<?php
namespace Common\ORG;  //封装时要命名空间

class SystemUtil{

public function get_success(){
return "success";
}
}

发表评论