第31篇熟悉老师与学生建房间与连接及php的date和include及require
2016-12-15 09:09
357 查看
关键词:WebRTC-IOS一对一bug处理,熟悉老师与学生建房间与连接,php的date和include及require
一、WebRTC-IOS一对一bug处理
1.1老师端(chrome)开房间VS学生(IOS手机)进
二、修改代码(学生端建房间、老师端进入)
2.1 熟悉老师与学生建房间与连接
1)老师端:connection.onopen如下:
connection.onopen = function() {
document.getElementById('input-text-chat').disabled = false;
document.getElementById('start_anwser').style.display = "";
document.getElementById('give_up').style.display = "";
if (connection.getAllParticipants().join(', ') == connection.sessionid){
var start_anwserBtn =document.getElementById("start_anwser");
start_anwserBtn.style.display ="none";
}
if (designer.pointsLength <= 0) {
// make sure that remote user gets alldrawings synced.
setTimeout(function() {
connection.send('plz-sync-points');
}, 1000);
}
};
2)学生端:connection.onopen如下:
connection.onopen = function() {
document.getElementById('input-text-chat').disabled = false;
MyAlert("<p class='ready'>课堂已连接</p>", 1000, "","", "auto", "auto", 1);
if (designer.pointsLength <= 0) {
// make sure that remote user gets alldrawings synced.
setTimeout(function() {
connection.send('plz-sync-points');
}, 1000);
}
};
3)老师端用到roomid
var roomid = params.roomid;
if (roomid &&roomid.length) {
connection.open(roomid, function() {
showRoomURL(connection.sessionid);
});
}
4) 这个函数用于获取网址中的房间号
(function() {
var params = {},
r = /([^&=]+)=?([^&]*)/g;
function d(s) {
returndecodeURIComponent(s.replace(/\+/g, ' '));
}
var match, search = window.location.search;
while (match = r.exec(search.substring(1)))
params[d(match[1])] = d(match[2]);
window.params = params;
})();
三、PHP
3.1 date()
PHP date() 函数用于格式化时间/日期,可把时间戳格式化为可读性更好的日期和时间。时间戳是一个字符序列,表示一定的事件发生的日期/时间。
语法如下:
string date ( string $format [, int $timestamp ] )
看个例子:
注:就是说日期输出时的其中三个参数Y、m、d,中间加什么修饰的符号,比方说反斜杠、冒号之类的随便加。还有其它的参数,具体如下:
3.2 php中include和require语句
include 和 require 语句用于在执行流中插入写在其他文件中的有用的代码。
include 和 require 除了处理错误的方式不同之外,在其他方面都是相同的:
1)require 生成一个致命错误(E_COMPILE_ERROR),在错误发生后脚本会停止执行。
2)include 生成一个警告(E_WARNING),在错误发生后脚本会继续执行。
语法如下:
include 'filename';
或者
require 'filename';
看个include的例子:
注:没有header.php的话,将报一个警告,但还会继续往下执行。
看个require的例子:
注:找不到header.php,程序就停在那里,不再往下执行。
2016年12月14日星期三
一、WebRTC-IOS一对一bug处理
1.1老师端(chrome)开房间VS学生(IOS手机)进
二、修改代码(学生端建房间、老师端进入)
2.1 熟悉老师与学生建房间与连接
1)老师端:connection.onopen如下:
connection.onopen = function() {
document.getElementById('input-text-chat').disabled = false;
document.getElementById('start_anwser').style.display = "";
document.getElementById('give_up').style.display = "";
if (connection.getAllParticipants().join(', ') == connection.sessionid){
var start_anwserBtn =document.getElementById("start_anwser");
start_anwserBtn.style.display ="none";
}
if (designer.pointsLength <= 0) {
// make sure that remote user gets alldrawings synced.
setTimeout(function() {
connection.send('plz-sync-points');
}, 1000);
}
};
2)学生端:connection.onopen如下:
connection.onopen = function() {
document.getElementById('input-text-chat').disabled = false;
MyAlert("<p class='ready'>课堂已连接</p>", 1000, "","", "auto", "auto", 1);
if (designer.pointsLength <= 0) {
// make sure that remote user gets alldrawings synced.
setTimeout(function() {
connection.send('plz-sync-points');
}, 1000);
}
};
3)老师端用到roomid
var roomid = params.roomid;
if (roomid &&roomid.length) {
connection.open(roomid, function() {
showRoomURL(connection.sessionid);
});
}
4) 这个函数用于获取网址中的房间号
(function() {
var params = {},
r = /([^&=]+)=?([^&]*)/g;
function d(s) {
returndecodeURIComponent(s.replace(/\+/g, ' '));
}
var match, search = window.location.search;
while (match = r.exec(search.substring(1)))
params[d(match[1])] = d(match[2]);
window.params = params;
})();
三、PHP
3.1 date()
PHP date() 函数用于格式化时间/日期,可把时间戳格式化为可读性更好的日期和时间。时间戳是一个字符序列,表示一定的事件发生的日期/时间。
语法如下:
string date ( string $format [, int $timestamp ] )
看个例子:
注:就是说日期输出时的其中三个参数Y、m、d,中间加什么修饰的符号,比方说反斜杠、冒号之类的随便加。还有其它的参数,具体如下:
3.2 php中include和require语句
include 和 require 语句用于在执行流中插入写在其他文件中的有用的代码。
include 和 require 除了处理错误的方式不同之外,在其他方面都是相同的:
1)require 生成一个致命错误(E_COMPILE_ERROR),在错误发生后脚本会停止执行。
2)include 生成一个警告(E_WARNING),在错误发生后脚本会继续执行。
语法如下:
include 'filename';
或者
require 'filename';
看个include的例子:
注:没有header.php的话,将报一个警告,但还会继续往下执行。
看个require的例子:
注:找不到header.php,程序就停在那里,不再往下执行。
2016年12月14日星期三
相关文章推荐
- 第32篇学生建房间与老师连接(二)
- 第33篇学生建房间连老师总结及IOS-WebRTC BUG处理(一)及php打开文件
- php中require和include的区别
- php里的include和require
- php内核:include与require区别的根本
- PHP中include()与require()的区别说明
- PHP中include()与require()的区别
- PHP中require/include与require_once/include_once的性能对比
- php中require和include的区别
- 【转帖】php include,include_once和require,require_once的根本区别
- php echo()和print()、require()和include()函数区别说明
- PHP include()和require()方法的区别
- php里的include和require
- PHP各种引入文件函数的执行效率include require fpassthru readfile
- PHP各种引入文件函数的执行效率include require fpassthru readfile
- php include VS require
- php学习笔记require() vs include()
- php include和require的区别
- php include,include_once,require,require_once
- PHP中include()与require()的区别说明