There are two fields in the database vod table:
qq$$$iqiyi$$$sohu$$$youku$$$mgtv
1$http://v.qq.com/x/cover/llws99784lrtpz7/g003189nkf3.html 2$http://v.qq.com/x/cover/llws99784lrtpz7/f0031cijuxc.html $$$http://www.iqiyi.com/v_19rse7ldt0.html 2$http://www.iqiyi.com/v_19rse7mbz0.html $$$http://tv.sohu.com/v/MjAxOTA2MjUvbjYwMDczMDI0MS5zaHRtbA==.html 2$http://tv.sohu.com/v/MjAxOTA2MjUvbjYwMDczMDI0My5zaHRtbA==.html $$$http://v.youku.com/v_show/id_XNDI0Mjg3NDcyOA==.html 2$http://v.youku.com/v_show/id_XNDI0Mjg3NDczMg==.html $$$http://www.mgtv.com/b/330256/5878154.html 2$http://www.mgtv.com/b/330256/5878408.html
public function getPlaylist(){ $datas['vod_play'] = explode('$$$', $this->vod_play); $datas['url'] = explode('$$$', $this->vod_url); $playlist=[]; if (is_array($datas)) { foreach ($datas as $key => $value) { foreach ($value as $k => $v) { $playlist[$k][$key] = $datas[$key][$k]; } } return $playlist; } }
public function actionUpdate($id) { $model = $this->findModel($id); $playlists= $model->getPlaylist(); if ($model->load(Yii::$app->request->post()) && $model->save()) { return $this->redirect(['view', 'id' => $model->vod_id]); } return $this->render('update', [ 'model' => $model, 'playlists'=>$playlists, ]); }
##Three, loop this array in the view:
' maxlength="30" aria-invalid="false">
In this way, activeform cannot be used to process the view, and a bunch of html and php have been written. The mixed code,
# is asking for help. Is there any other way to implement it? Can I use activeform in the view to handle it?
Thanks!