php基礎 轉換圖片路徑 轉換時間格式 兩表聯合查詢示例

//二維數組循環將時間戳轉換格式
 foreach ($newsList as $key => $value) {
     $newsList[$key]['createtime']=date('Y-m-d H:i:s',$newsList[$key]['createtime']);
 }

//循環將圖片路徑換成線上路徑   一維數組
 foreach ($banner['lb_imgs'] as &$item) {
     $item = tomedia($item);
 }

//微擎中 pdo_getall()
$courselist=pdo_getall('yzpx_sun_course', array('uniacid' => $_W['uniacid'],'rec'=>1,'type'=>1),array('id','img', 'title','start_time',));

//微擎中 pdo_getall()
$info = pdo_fetchall("select id from " . tablename('yzpx_sun_user') . " where `uniacid`='$uniacid' and openid='$openid'");

//兩表聯合查詢
$teacherlist=pdo_fetchall("select a.*,b.name as sname from ". tablename('yzpx_sun_teacher')." a left join ".tablename('yzpx_sun_school')."b on b.id=a.sid where a.id='$tid' and a.uniacid = ".$_W['uniacid'] ." order BY a.age desc");

//將字符串分割成數組
$banner['lb_imgs']=explode(",",$banner['lb_imgs']);




 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章