-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathindex.php
55 lines (42 loc) · 1.02 KB
/
index.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
<?php
/**
* Created by PhpStorm.
* User: Administrator
* Date: 2018/3/7
* Time: 14:13
*/
header('Access-Control-Allow-Origin: *');
//当前目录
$path = __DIR__;
require_once($path.DIRECTORY_SEPARATOR.'db.php');
$name = $_POST['name'] ?? '';
$url = $_POST['url'] ?? '';
if($url){
$arr = [
'name' => addslashes($name),
'url' => addslashes($url),
];
phpLog('添加视频参数');
phpLog($arr);
$Conn = new Mysql();
$res = $Conn ->Table('vod')->Into($arr);
phpLog('添加视频完成');
phpLog($res);
exit(json_encode(['msg'=>'添加完成']));
}
/**
* 调试时候用来写日志文件的函数
*
* @param filename 保存的文件名
*
* @author <[email protected]>
*/
function phpLog($str)
{
$time = "\n\t" . date('Y-m-d H:i:s', time()) . "------------------------------------------------------------------------------------\n\t";
if (is_array($str))
{
$str = var_export($str, true);
}
file_put_contents('./log.php', $time . $str, FILE_APPEND);
}