例子
1.静态
2.js
function openWind(tit,w,h,url)
{
$.dialog({
title:tit,
width:w+"px",
height:h+"px",
content:'url:'+url,
fixed:false
});
}
3.控制器内
namespace app\home\controller;
use app\home\model\RecruitmentModel;
use think\Controller;
use think\Db;
class Recruitment extends Base
{
public function recruitment(){
$recruitment = Db::name('recruitment')->select();
$this -> assign('recruitment',$recruitment);
return $this->fetch();
}
public function getData(){
$id = input('param.id');
$model = new RecruitmentModel();
$result = $model->getIntro($id);
$this->assign('result',$result);
return $this->fetch();
}
}
4.模型内
namespace app\home\model;
use think\Model;
use think\Db;
class RecruitmentModel extends Model
{
public function getKuang($id){
$goods = $this->where('id',$id)->find();
}
public function getIntro($id){
return Db::name('recruitment')->where('id',$id)->find();
}
}