class Jijiajian extends Base
{
public function jijiajianList()
{
$count = JijiajianModel::count();
foreach ($jijiajianListas $ ue){# ->id,
'xuhao' => $value->xuhao,
> $value->name,
'shuliang' => $value->shuliang,
'danzhong' => $value->danzhong,
cmilia>o, $cooo'an o>#ow*h ', $cnilia> ' => $value->leibie,
'guige' => $value->guige,
'leibie2' => > $value->beizhu,
'luruyuan' => $value->luruyuan,
'lururiqi' => $value $value->status,
'create_time' => $value->create_time,# ;tuhao)? $value-> ;gongyika->tuhao : '<span style="color:red;">未分配</span>',
$jijiajianList[] = $ data;
}
$this -> view -> assign('jijiajianList', $jijiajianList);
$this -> view -> assign('count', $#count); return $this -> view -> fetch('jijiajian');
<?php
namespace app\index\model;
use think\ Model;use traits\model\SoftDelete;
class Jijiajian extends Model
//引用軟體刪除方法集
use SoftDelete;
設定目前表預設日期時間顯示格式
//定義表中的刪除時間欄位,來記錄刪除時間
// 開啟自動寫入時間戳記
protected $ dTime 'create_time';
protected $insert = ['status' => 1];
## {
return $this->belongsTo('gongyika');
} #項目 關係{
return $this->hasMany('student');
}*/
#}
#請問老師,上述程式碼,機器加件表裡的資料咋顯示不出來呢,$count=0,資料取得不到,同樣的程式碼,另外一個表就沒事
<?php
use think\Model;
{
//引用軟體移除方法集use SoftDelete;
//設定目前表格預設日期時間顯示格式
protected $dateFormat = 'Y/m/d';
protected $dateFormat = 'Y/m/d';
表中的刪除時間字段,來記錄刪除時間
protected $deleteTime = 'delete_time';
// 開啟自動寫入時間戳
protected $autoWriteTimestamp = true;
protected $createTime = 'create_time';
## protected $updateTime = 'update_time';
protected ];
public function jijiajian()
{
// 班級表與教師表與教師表為1對1關係
## }
}
namespace app\index\controller;
use app\index\model\Gongyika as GongyikaModel;
use app\index\model\Jijiajian;
use think\Request;
class Gongyika extends Base
{
public function gongyikaList = GongyikaModel::all();
//$gongyikaList =GongyikaModel::select();
GongyikaModel::count();
//
foreach ($gongyikaList as $value){
'id' => $value->id, //主鍵
' chanpinxinghao' => $value->chanpinxinghao, //產品型號
'chanpinname' => hao' => $value-> tuhao, //零件圖號
'lingjianname' => $value->lingjianname, //零件名稱「 //材質
' maopizhonglei' => $value->maopizhonglei, //毛坯種類
'pihao' => $value->pihao, ; $value->meitaijianshu, //每台件數
'gongxuhao' => $value->gongxuhao, //工序號
'gongxuname' => $vval; /工序名稱
'gongbuhao' =>; => $value->sel1, //設備型號
'sel2' => $value->sel2, //刀具型號
'zhunbeigongshi' => $value-> //準備工時
'danjiangongshi' => $value->danjiangongshi, //單件工時
'create_time' => -o ;#>oo $value->status, //目前啟用狀態
'jijiajian' => isset($value->jijiajian->tuhao)? $value->jijiajian->tuhao : '<span style="color:red;">未分配</ span>',
];
//每次使用相關查詢結果,儲存於陣列 }
$this - > view -> assign('gongyikaList', $gongyikaList);
# seo模板變數
}
#