php后臺(tái)保存數(shù)據(jù)并指向一個(gè)關(guān)閉layer窗口的方法

這篇文章主要介紹php后臺(tái)保存數(shù)據(jù)并指向一個(gè)關(guān)閉layer窗口的方法,文中介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們一定要看完!

十年的和碩網(wǎng)站建設(shè)經(jīng)驗(yàn),針對(duì)設(shè)計(jì)、前端、開發(fā)、售后、文案、推廣等六對(duì)一服務(wù),響應(yīng)快,48小時(shí)及時(shí)工作處理。全網(wǎng)營銷推廣的優(yōu)勢(shì)是能夠根據(jù)用戶設(shè)備顯示端的尺寸不同,自動(dòng)調(diào)整和碩建站的顯示方式,使網(wǎng)站能夠適用不同顯示終端,在瀏覽器中調(diào)整網(wǎng)站的寬度,無論在任何一種瀏覽器上瀏覽網(wǎng)站,都能展現(xiàn)優(yōu)雅布局與設(shè)計(jì),從而大程度地提升瀏覽體驗(yàn)。成都創(chuàng)新互聯(lián)從事“和碩網(wǎng)站設(shè)計(jì)”,“和碩網(wǎng)站推廣”以來,每個(gè)客戶項(xiàng)目都認(rèn)真落實(shí)執(zhí)行。

介紹一款非常好用的前端彈窗插件:

layer 官網(wǎng)地址:http://layer.layui.com/

根據(jù)官方的API:layer的iframe彈窗

//iframe層-父子操作
layer.open({ 
 type: 2, 
 area: ['700px', '530px'], 
 fix: false, //不固定 
 maxmin: true, 
 content: 'test/iframe.html'
});

這里以php開發(fā)為例 演示如何 提交表單后自動(dòng)關(guān)閉layer彈窗

(1)彈出layer編輯框 :

function edit(id){
 if(id==null||id==''||id=='undefined'){
 alert('操作編號(hào)為空,請(qǐng)聯(lián)系管理員');
 }
 
 layer.open({
  type: 2,
  area: ['700px', '530px'],
  fix: false, //不固定
  maxmin: true,
  content: 'index.php?m=content&c=meiti&a=edit_paiqi&id='+id
 });
}

(2)編輯頁面主要代碼

<input name="dosubmit" type="submit" id="dosubmit" value="提交" class="button" >

(3)php后臺(tái)保存數(shù)據(jù)并指向一個(gè)關(guān)閉layer窗口的方法

public function edit_config_paiqi(){
		$id = trim($_REQUEST['id']);
		$paiqi_db = pc_base::load_model('paiqi_config_model');
		if($_REQUEST['dosubmit']){
			$insertinfo = array();
			$insertinfo['catid'] = trim($_POST['catid']);
			$insertinfo['meitiid'] = trim($_POST['meitiid']);
			$insertinfo['title'] = trim($_POST['title']);	
			$insertinfo['meitizhuname'] = trim($_POST['meitizhuname']);
			$insertinfo['meitizhuid'] = trim($_POST['meitizhuid']);
			$insertinfo['createtime'] = SYS_TIME;
			$insertinfo['saturation'] = trim($_POST['saturation']);
			$datas = $paiqi_db->update($insertinfo,array("id"=>$id));
			if($datas){
				<span style="color:#ff0000;">showmessage(L('operation_success'),'?m=content&c=meiti&a=closewindow');//保存成功指向關(guān)閉窗口方法</span>
			}
		}else{
			$datas = $paiqi_db->select(array("id"=>$id));
			$template = "edit_config_paiqi";
			include $this->admin_tpl($template);
		}
	}
	/**
	 * 關(guān)閉layer層
	 */
	public function closewindow(){
		$template = "close_layer";
		include $this->admin_tpl($template);
	}

(4)關(guān)閉窗口并刷新父窗口頁面的關(guān)鍵代碼

$(function(){
 parent.location.reload();//刷新父窗口 
 parent.layer.closeAll();//關(guān)閉所有l(wèi)ayer窗口
});

注意:該頁面需要加載layer需要的js庫才能使用layer方法

以上是php后臺(tái)保存數(shù)據(jù)并指向一個(gè)關(guān)閉layer窗口的方法的所有內(nèi)容,感謝各位的閱讀!希望分享的內(nèi)容對(duì)大家有幫助,更多相關(guān)知識(shí),歡迎關(guān)注創(chuàng)新互聯(lián)行業(yè)資訊頻道!

網(wǎng)頁題目:php后臺(tái)保存數(shù)據(jù)并指向一個(gè)關(guān)閉layer窗口的方法
URL網(wǎng)址:http://bm7419.com/article12/jjspgc.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供定制網(wǎng)站網(wǎng)站建設(shè)、品牌網(wǎng)站制作、網(wǎng)站排名微信公眾號(hào)、外貿(mào)建站

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來源: 創(chuàng)新互聯(lián)

小程序開發(fā)