userModel.class.php
[PHP] 纯文本查看 复制代码 <?php
namespace Models\Model;
use Think\Model;
// 对应数据表:user
class UserModel extends Model
{
// 默认对应数据表:sa_user
protected $tableName = 'wish'; // 对应sa_wish;
protected $tablePrefix = 'db_'; // 对应db_wish;
protected $trueTableName = 'sa_AdminUser'; // 对应sa_AdminUser;
}
IndexController.class.php
[PHP] 纯文本查看 复制代码 <?php
namespace Models\Controller;
use Think\Controller;
class IndexController extends Controller {
public function index(){
// new
$user_model = new \Models\Model\UserModel();
// M
$user_m_model = M('User');
// D
$user_d_model = D('User');
// 空模型
$empty_model = new Think\Model();
$empty_m_model = M();
$empty_d_model = D();
}
}
|