BFWSOA模型简介

模型分为表模型,视图模型


<?php
namespace App\Blog\Model;

use Lib\Bfw;
use Lib\BoModel;
use Lib\BoConfig;

/**
 * @author Herry
 * 文章数据模型
 */
class Model_Album extends BoModel
{

    protected $_prikey = "id";

    protected $_isview = false;

    private static $_instance;

    function __construct()
    {
        $this->_cBfwOnnarray= BoConfig::Config("Db", "localconfig");
        parent::__construct();
    }

    /**
     * 获取单例
     *
     * @return Model
     */
    public static function getInstance()
    {
        if (! (self::$_instance instanceof self)) {
            self::$_instance = new self();
        }
        return self::$_instance;
    }


    /*
     * protected $_cBfwOnnarray= array(
     * "dbtype" => "DbMysql",
     * "dbconnstr" => "mysql:host=127.0.0.1;dbname=88art",
     * "dbport" => 3306,
     * "dbuser" => "root",
     * "dbpwd" => ""
     * );
     */
}

?>
视图模型为

<?php
namespace App\Blog\Model;

use Lib\Bfw;
use Lib\BoModel;
use Lib\BoConfig;

/**
 * @author Herry
 * 文章数据模型
 */
class Model_Album extends BoModel
{

    protected $_prikey = "id";

    protected $_isview = true;
    
    protected  $_cpsql="select * from [[Article]]  as a left join [[Tag]] as b on a.id=b.tid"  ;

    private static $_instance;

    function __construct()
    {
        $this->_cBfwOnnarray= BoConfig::Config("Db", "localconfig");
        parent::__construct();
    }

    /**
     * 获取单例
     *
     * @return Model
     */
    public static function getInstance()
    {
        if (! (self::$_instance instanceof self)) {
            self::$_instance = new self();
        }
        return self::$_instance;
    }


    /*
     * protected $_cBfwOnnarray= array(
     * "dbtype" => "DbMysql",
     * "dbconnstr" => "mysql:host=127.0.0.1;dbname=88art",
     * "dbport" => 3306,
     * "dbuser" => "root",
     * "dbpwd" => ""
     * );
     */
}

?>

{{collectdata}}

网友评论0

阿里云香港主机,免备案大优惠 打开浏览器开发html,体验云开发的乐趣bfweditor 打开浏览器即可开发php,bfwstudio
其他文章