第69篇一对多之接上前端进课堂两种模式开发及array_udiff
2017-03-10 15:39
246 查看
关键词:接上前端进课堂,
两种模式开发, array_udiff
一、加载控制语音视频代码
1.1 测试平台
1)本地服务器运行平台
老师端:https://localhost:9101/demos/index.html?roomid=888&t=600
学生一:
https://localhost:9101/demos/student.html?studentId=1001&userAvatar=http://123.57.206.36:8003/uploadfiles/2016/11/1479740395ZMJkiF.jpg&t=600#888
学生二:
https://localhost:9101/demos/student.html?studentId=1002&userAvatar=http://123.57.206.36:8003/uploadfiles/2016/11/1480494624FDjMGetutor.png&t=600#888
学生三:
https://localhost:9101/demos/student.html?studentId=1003&userAvatar=http://123.57.206.36:8003/uploadfiles/2016/11/1480475198N2F0kntutor.png&t=600#888
2)备用服务器运行平台
老师端:https://123.57.206.36:9101/demos/index.html?roomid=888&t=600
学生一:
https://123.57.206.36:9101/demos/student.html?studentId=1001&userAvatar=http://123.57.206.36:8003/uploadfiles/2016/11/1479740395ZMJkiF.jpg&t=600#888
学生二:
https://123.57.206.36:9101/demos/student.html?studentId=1002&userAvatar=http://123.57.206.36:8003/uploadfiles/2016/11/1480494624FDjMGetutor.png&t=600#888
学生三:
https://123.57.206.36:9101/demos/student.html?studentId=1003&userAvatar=http://123.57.206.36:8003/uploadfiles/2016/11/1480475198N2F0kntutor.png&t=600#888
1.2 接上前端进课堂
1)老师创建课堂的存表--------classroom_model.php
注:存到了paperclass里面。
1.3 接上之后的BUG
1)一个学生退出,课堂不应结束
a.)问题描述
现在一个老师连两个学生,如果一个学生退出,不应该使课堂结束。
在本地改就成。
2)两个模式
a.)问题描述
分两个模式:课堂模式和课后模式,课堂模式,所有学生切换到共享白板;课后模式,所有学生切换到私有白板。
b.) 课堂模式开发
实现代码如下:
b1.)先来个按钮
<button type="button" id="onClass-btn"onclick ="onClass()">课堂模式</button>
b2.) onClass()函数
//课堂模式----------------------------------模式1-----------------------------------------4.1
function onClass() {
connection.send("onClass");
}
注:向学生端发个消息,使其关闭本地声音,并切换到共享白板
b3.) 学生端收到消息
//课堂模式----此时全员禁音且学生都切换到共享白板
if (event.data === 'onClass') {
//全员禁音
connection.removeStream(connection.localMediaStreamId);
//所有学生切换到共享白板
toSharedWB();
return;
}
注:收到消息后,关声音,切换到私有白板。
c.) 课后模式开发
实现代码如下:
c1.)先来个按钮
<button type="button"id="afterClass-btn" onclick ="afterClass()">课后模式</button>
c2.) afterClass()函数
//课后模式-------------------------------模式2--------------------------------------------4.2
function afterClass() {
connection.send("afterClass");
}
注:向学生端发个消息,使其关闭本地声音,并切换到私有白板
c3.) 学生端收到消息
//课后模式----此时全员禁音且学生都切换到私有白板
if (event.data === 'afterClass') {
//全员禁音
connection.removeStream(connection.localMediaStreamId);
//所有学生切换到共享白板
toPrivateWB();
return;
}
注:收到消息后,关声音,切换到共享白板。
二、php
2.1 PHP array_udiff() 函数
1)定义和用法
array_udiff()函数用于比较两个(或更多个)数组的键值 ,并返回差集。
注释:该函数使用用户自定义函数比较键值!
该函数比较两个(或更多个)数组的键值,并返回一个差集数组,该数组包括了所有在被比较的数组(array1)中,但是不在任何其他参数数组(array2 或 array3 等等)中的键值。
2)语法
array_udiff(array1,array2,array3...,myfunction)
3)例子
a.)例子一如下:
比较三个数组的键值(使用用户自定义函数比较键值),并返回差集:
注:只要值一样,就不能返回到结果集中。
b.)例子二
注:这个和上边的例子是一样的,主要是看自定义函数怎么写。
2017年3月10日星期五
两种模式开发, array_udiff
一、加载控制语音视频代码
1.1 测试平台
1)本地服务器运行平台
老师端:https://localhost:9101/demos/index.html?roomid=888&t=600
学生一:
https://localhost:9101/demos/student.html?studentId=1001&userAvatar=http://123.57.206.36:8003/uploadfiles/2016/11/1479740395ZMJkiF.jpg&t=600#888
学生二:
https://localhost:9101/demos/student.html?studentId=1002&userAvatar=http://123.57.206.36:8003/uploadfiles/2016/11/1480494624FDjMGetutor.png&t=600#888
学生三:
https://localhost:9101/demos/student.html?studentId=1003&userAvatar=http://123.57.206.36:8003/uploadfiles/2016/11/1480475198N2F0kntutor.png&t=600#888
2)备用服务器运行平台
老师端:https://123.57.206.36:9101/demos/index.html?roomid=888&t=600
学生一:
https://123.57.206.36:9101/demos/student.html?studentId=1001&userAvatar=http://123.57.206.36:8003/uploadfiles/2016/11/1479740395ZMJkiF.jpg&t=600#888
学生二:
https://123.57.206.36:9101/demos/student.html?studentId=1002&userAvatar=http://123.57.206.36:8003/uploadfiles/2016/11/1480494624FDjMGetutor.png&t=600#888
学生三:
https://123.57.206.36:9101/demos/student.html?studentId=1003&userAvatar=http://123.57.206.36:8003/uploadfiles/2016/11/1480475198N2F0kntutor.png&t=600#888
1.2 接上前端进课堂
1)老师创建课堂的存表--------classroom_model.php
注:存到了paperclass里面。
1.3 接上之后的BUG
1)一个学生退出,课堂不应结束
a.)问题描述
现在一个老师连两个学生,如果一个学生退出,不应该使课堂结束。
在本地改就成。
2)两个模式
a.)问题描述
分两个模式:课堂模式和课后模式,课堂模式,所有学生切换到共享白板;课后模式,所有学生切换到私有白板。
b.) 课堂模式开发
实现代码如下:
b1.)先来个按钮
<button type="button" id="onClass-btn"onclick ="onClass()">课堂模式</button>
b2.) onClass()函数
//课堂模式----------------------------------模式1-----------------------------------------4.1
function onClass() {
connection.send("onClass");
}
注:向学生端发个消息,使其关闭本地声音,并切换到共享白板
b3.) 学生端收到消息
//课堂模式----此时全员禁音且学生都切换到共享白板
if (event.data === 'onClass') {
//全员禁音
connection.removeStream(connection.localMediaStreamId);
//所有学生切换到共享白板
toSharedWB();
return;
}
注:收到消息后,关声音,切换到私有白板。
c.) 课后模式开发
实现代码如下:
c1.)先来个按钮
<button type="button"id="afterClass-btn" onclick ="afterClass()">课后模式</button>
c2.) afterClass()函数
//课后模式-------------------------------模式2--------------------------------------------4.2
function afterClass() {
connection.send("afterClass");
}
注:向学生端发个消息,使其关闭本地声音,并切换到私有白板
c3.) 学生端收到消息
//课后模式----此时全员禁音且学生都切换到私有白板
if (event.data === 'afterClass') {
//全员禁音
connection.removeStream(connection.localMediaStreamId);
//所有学生切换到共享白板
toPrivateWB();
return;
}
注:收到消息后,关声音,切换到共享白板。
二、php
2.1 PHP array_udiff() 函数
1)定义和用法
array_udiff()函数用于比较两个(或更多个)数组的键值 ,并返回差集。
注释:该函数使用用户自定义函数比较键值!
该函数比较两个(或更多个)数组的键值,并返回一个差集数组,该数组包括了所有在被比较的数组(array1)中,但是不在任何其他参数数组(array2 或 array3 等等)中的键值。
2)语法
array_udiff(array1,array2,array3...,myfunction)
3)例子
a.)例子一如下:
比较三个数组的键值(使用用户自定义函数比较键值),并返回差集:
注:只要值一样,就不能返回到结果集中。
b.)例子二
注:这个和上边的例子是一样的,主要是看自定义函数怎么写。
2017年3月10日星期五
相关文章推荐
- 两种设计模式在EJB开发中的应用
- Asp.Net Ajax的两种基本开发模式
- Web前端开发中的MCRV模式
- Web前端开发中的MCRV模式
- asp.net ajax 两种开发模式
- 提高软件开发效率的两种工作模式
- <转>前端开发中的MCRV模式
- Asp.Net Ajax的两种基本开发模式
- Asp.Net Ajax的两种基本开发模式
- 两种SVN开发模式
- Asp.Net Ajax的两种基本开发模式
- 两种SVN开发模式实现目录结构布局
- 开发平台的两种实现模式
- 两种SVN开发模式实现目录结构布局
- 快速开发工具的两种实现模式
- 选择用哪种模式做前端开发?
- 浅谈JSP网站开发技术中的两种模式
- 开发平台的两种实现模式
- Web前端开发中的MCRV模式
- Web前端开发JavaScript设计模式 -- 单体模式(The Singleton Pattern)