<div class="dialog-comment-list-box"><div class="loading-img"><table><tr><td><img src="/static/imghwm/default1.png" data-src="tpl/default/img/loading.gif" class="lazy" alt="loading"><p>正在加载联系人</p></td></tr></table></div><ul class="dialog-comment-list"><!-- <li class="dialog-comment-list-item">what's going on?</li><li class="dialog-comment-list-item reply">what's going on?</li><li class="dialog-comment-list-item">what's this?</li><li class="dialog-comment-list-item">what's this?</li><li class="dialog-comment-list-item reply">???</li><li class="dialog-comment-list-item"><img src="/static/imghwm/default1.png" data-src="http://pic.yupoo.com/huang-yu/DFR1RRtM/small.jpg" class="lazy" alt="pic"></li> --></ul><!-- /.dialog-comment-list --></div><div class="dialog-comment-edit"><textarea name="" id="edit"></textarea></div><!-- /.dialog-comment-edit --><div class="site-im-dialog-footer"><div class="for-post" data-toggle="popover" data-content="<small>写点什么再发吧!</small>"><kbd><kbd>Ctrl</kbd>+<kbd>Enter</kbd></kbd><button class="btn btn-success btn-sm" id="post-reply"><i class="fa fa-paper-plane"></i> 发送</button></div></div><!-- /.site-im-dialog-footer --></div>
/** * 发送信息/获取信息 */// 清除定时器function clearChatTimers(id){ if(id){ //请除指定用户定时执行 if(aPChatTimers[id]){ clearTimeout(aPChatTimers[id]); loadFlag = false;// console.log('clear:'+aPChatTimers[id]); } }else{ //请除所有用户定时执行 for (var i=0;i<aPChatTimers.length;i++){ if(aPChatTimers[i]){ loadFlag = false; clearTimeout(aPChatTimers[i]);// console.log('clear:'+aPChatTimers[i]); } } } };/*uid *//** * 返回接收者Id * @returns */function getRecipientIdFromReplyBtn(){ var uid = $.trim($("#post-reply").attr('data-send-uid')); if(uid == undefined||uid ==''){ uid = false; } return uid;}/** * 清空发送的文本内容 * @returns */function clearInputMessage(){ $("#edit").val(''); $("#post-reply").focus();}/** * 获取发送的文本内容 * @returns */function getInputMessage(){ var sMsg = $.trim($("#edit").val()); if(sMsg == undefined||sMsg ==''){ sMsg = false; } return sMsg;}//发送信息 function sendPrivateMessages(){ var uid,message; uid = getRecipientIdFromReplyBtn(); message = getInputMessage(); if(message === false){ $('.for-post').popover('show'); $("#edit").focus(function() { $('.for-post').popover('hide'); }); return false; } $("#post-reply").attr('disabled','disabled'); clearChatTimers(0); //index.php?do=webim&action=send_messages POST $.post('index.php?do=webim',{action:'send_messages',uid:uid,sMessage:message}, function(json) { if(json.status == '1'){ if($('.dialog-comment-list').find('li').length >0){ var _scrollHeight = $('.dialog-comment-list').find('li').last().offset().top; $("#post-reply").closest('.site-im-dialog').find('.dialog-comment-list').animate({zoom:1},function(){ $(".dialog-comment-list-box").data('jsp').scrollTo(0, _scrollHeight); }); } $("#post-reply").removeAttr('disabled'); clearInputMessage(); clearChatTimers(0); getPrivateMessages(uid); }else{ tipsOp(json.msg,'error'); $("#post-reply").removeAttr('disabled'); } },'json');}
返回 {"msg":"\u53d1\u9001\u6210\u529f","status":"1","data":[]}
单击发送或 Ctrl+Enter 按钮不抬起 (如图)
如何才能单击发送按钮或者按CTRL+ENTER 把数据POST到php处理 求PHP代码
回复讨论(解决方案)
你这代码是啥问题 后台获取不到还是啥?说得具体点。
你这代码是啥问题 后台获取不到还是啥?说得具体点。
php 获取不到
你这代码是啥问题 后台获取不到还是啥?说得具体点。
HTML代码
<button class="btn btn-success btn-sm" id="post-reply"><i class="fa fa-paper-plane"></i> 发送</button>
//发送信息 function sendPrivateMessages(){ var uid,message; uid = getRecipientIdFromReplyBtn(); message = getInputMessage(); if(message === false){ $('.for-post').popover('show'); $("#edit").focus(function() { $('.for-post').popover('hide'); }); return false; } $("#post-reply").attr('disabled','disabled'); // 单击按钮之后 按钮是disabled 禁止的 clearChatTimers(0); //index.php?do=webim&action=send_messages POST 到 后端处理 // php返回 json数据 {"msg":"\u53d1\u9001\u6210\u529f","status":"1","data":[]} /* 我对js实在不行, 不知php 如何获取 post 数据 */ $.post('index.php?do=webim',{action:'send_messages',uid:uid,sMessage:message}, function(json) { if(json.status == '1'){ if($('.dialog-comment-list').find('li').length >0){ var _scrollHeight = $('.dialog-comment-list').find('li').last().offset().top; $("#post-reply").closest('.site-im-dialog').find('.dialog-comment-list').animate({zoom:1},function(){ $(".dialog-comment-list-box").data('jsp').scrollTo(0, _scrollHeight); }); } $("#post-reply").removeAttr('disabled'); clearInputMessage(); clearChatTimers(0); getPrivateMessages(uid); }else{ tipsOp(json.msg,'error'); $("#post-reply").removeAttr('disabled'); } },'json');}
执行 $.post('index.php?do=webim',{action:'send_messages',uid:uid,sMessage:message} ... 后
php 得到
$_GET['do'] 为 webim
$_POST['action'] 为 send_messages
$_POST['uid'] 为 uid 的值
$_POST['sMessage'] 为 message 的值
执行 $.post('index.php?do=webim',{action:'send_messages',uid:uid,sMessage:message} ... 后
php 得到
$_GET['do'] 为 webim
$_POST['action'] 为 send_messages
$_POST['uid'] 为 uid 的值
$_POST['sMessage'] 为 message 的值
谢了,我以为 action 是GET参数

PHP는 주로 절차 적 프로그래밍이지만 객체 지향 프로그래밍 (OOP)도 지원합니다. Python은 OOP, 기능 및 절차 프로그래밍을 포함한 다양한 패러다임을 지원합니다. PHP는 웹 개발에 적합하며 Python은 데이터 분석 및 기계 학습과 같은 다양한 응용 프로그램에 적합합니다.

PHP는 1994 년에 시작되었으며 Rasmuslerdorf에 의해 개발되었습니다. 원래 웹 사이트 방문자를 추적하는 데 사용되었으며 점차 서버 측 스크립팅 언어로 진화했으며 웹 개발에 널리 사용되었습니다. Python은 1980 년대 후반 Guidovan Rossum에 의해 개발되었으며 1991 년에 처음 출시되었습니다. 코드 가독성과 단순성을 강조하며 과학 컴퓨팅, 데이터 분석 및 기타 분야에 적합합니다.

PHP는 웹 개발 및 빠른 프로토 타이핑에 적합하며 Python은 데이터 과학 및 기계 학습에 적합합니다. 1.PHP는 간단한 구문과 함께 동적 웹 개발에 사용되며 빠른 개발에 적합합니다. 2. Python은 간결한 구문을 가지고 있으며 여러 분야에 적합하며 강력한 라이브러리 생태계가 있습니다.

PHP는 현대화 프로세스에서 많은 웹 사이트 및 응용 프로그램을 지원하고 프레임 워크를 통해 개발 요구에 적응하기 때문에 여전히 중요합니다. 1.PHP7은 성능을 향상시키고 새로운 기능을 소개합니다. 2. Laravel, Symfony 및 Codeigniter와 같은 현대 프레임 워크는 개발을 단순화하고 코드 품질을 향상시킵니다. 3. 성능 최적화 및 모범 사례는 응용 프로그램 효율성을 더욱 향상시킵니다.

phphassignificallyimpactedwebdevelopmentandextendsbeyondit

PHP 유형은 코드 품질과 가독성을 향상시키기위한 프롬프트입니다. 1) 스칼라 유형 팁 : PHP7.0이므로 int, float 등과 같은 기능 매개 변수에 기본 데이터 유형을 지정할 수 있습니다. 2) 반환 유형 프롬프트 : 기능 반환 값 유형의 일관성을 확인하십시오. 3) Union 유형 프롬프트 : PHP8.0이므로 기능 매개 변수 또는 반환 값에 여러 유형을 지정할 수 있습니다. 4) Nullable 유형 프롬프트 : NULL 값을 포함하고 널 값을 반환 할 수있는 기능을 포함 할 수 있습니다.

PHP에서는 클론 키워드를 사용하여 객체 사본을 만들고 \ _ \ _ Clone Magic 메소드를 통해 클로닝 동작을 사용자 정의하십시오. 1. 복제 키워드를 사용하여 얕은 사본을 만들어 객체의 속성을 복제하지만 객체의 속성은 아닙니다. 2. \ _ \ _ 클론 방법은 얕은 복사 문제를 피하기 위해 중첩 된 물체를 깊이 복사 할 수 있습니다. 3. 복제의 순환 참조 및 성능 문제를 피하고 클로닝 작업을 최적화하여 효율성을 향상시키기 위해주의를 기울이십시오.

PHP는 웹 개발 및 컨텐츠 관리 시스템에 적합하며 Python은 데이터 과학, 기계 학습 및 자동화 스크립트에 적합합니다. 1.PHP는 빠르고 확장 가능한 웹 사이트 및 응용 프로그램을 구축하는 데 잘 작동하며 WordPress와 같은 CMS에서 일반적으로 사용됩니다. 2. Python은 Numpy 및 Tensorflow와 같은 풍부한 라이브러리를 통해 데이터 과학 및 기계 학습 분야에서 뛰어난 공연을했습니다.


핫 AI 도구

Undresser.AI Undress
사실적인 누드 사진을 만들기 위한 AI 기반 앱

AI Clothes Remover
사진에서 옷을 제거하는 온라인 AI 도구입니다.

Undress AI Tool
무료로 이미지를 벗다

Clothoff.io
AI 옷 제거제

AI Hentai Generator
AI Hentai를 무료로 생성하십시오.

인기 기사

뜨거운 도구

Dreamweaver Mac版
시각적 웹 개발 도구

PhpStorm 맥 버전
최신(2018.2.1) 전문 PHP 통합 개발 도구

맨티스BT
Mantis는 제품 결함 추적을 돕기 위해 설계된 배포하기 쉬운 웹 기반 결함 추적 도구입니다. PHP, MySQL 및 웹 서버가 필요합니다. 데모 및 호스팅 서비스를 확인해 보세요.

Eclipse용 SAP NetWeaver 서버 어댑터
Eclipse를 SAP NetWeaver 애플리케이션 서버와 통합합니다.

WebStorm Mac 버전
유용한 JavaScript 개발 도구
