/** * ===嵌入表单=== * 获取表单信息保存到json */ public function insetForm() { $websiteFormInfo = websiteConfig::where('cus_id', $this->cus_id)->where('template_id', $this->tpl_id)->where('key', 'form')->pluck('value'); if (!empty($websiteFormInfo)) { $websiteFormArray = unserialize($websiteFormInfo); $ids = array(); $bind = array(); foreach ($websiteFormArray as $key => $value) { $bind[substr($key, strlen($key) - 1)][substr($key, 0, -1)] = $value['value']; if (array_key_exists('form_id', $value['value'])) { if (!in_array($value['value']['form_id'], $ids)) { $ids[] = $value['value']['form_id']; } } } $FormC = new FormController(); $formInfo = $FormC->getFormInfoByIds($ids); $data['forminfo'] = $formInfo; $data['website'] = $bind; file_put_contents(public_path("customers/" . $this->customer . '/formdata.json'), json_encode($data)); return '<script type="text/javascript" src="/quickbar/js/form.js?name=' . $this->customer . '"></script>'; } else { return ''; } }