diff --git a/Framework/Autoload.php b/Framework/Autoload.php new file mode 100644 index 0000000..8ae6cc8 --- /dev/null +++ b/Framework/Autoload.php @@ -0,0 +1 @@ + '127.0.0.1', 'port' => '5672', 'login' => 'admin', 'password' => 'admin', 'vhost'=>'/' ); $e_name = 'e_linvo'; //交换机名 $q_name = 'q_linvo'; //队列名 $k_route = 'key_1'; //路由key //创建连接和channel $conn = new AMQPConnection($conn_args); if (!$conn->connect()) { die("Cannot connect to the broker!\n"); } $channel = new AMQPChannel($conn); //创建交换机 $ex = new AMQPExchange($channel); $ex->setName($e_name); $ex->setType(AMQP_EX_TYPE_DIRECT); //direct类型 $ex->setFlags(AMQP_DURABLE); //持久化 echo "Exchange Status:".$ex->declare()."\n"; //创建队列 $q = new AMQPQueue($channel); $q->setName($q_name); $q->setFlags(AMQP_DURABLE); //持久化 echo "Message Total:".$q->declare()."\n"; //绑定交换机与队列,并指定路由键 echo 'Queue Bind: '.$q->bind($e_name, $k_route)."\n"; //阻塞模式接收消息 echo "Message:\n"; while(True){ $q->consume('processMessage'); } $conn->disconnect(); /** * 消费回调函数 * 处理消息 */ function processMessage($envelope, $queue) { $msg = $envelope->getBody(); echo $msg."\n"; //处理消息 $queue->ack($envelope->getDeliveryTag()); //手动发送ACK应答 } \ No newline at end of file diff --git a/composer.json b/composer.json new file mode 100644 index 0000000..97770fb --- /dev/null +++ b/composer.json @@ -0,0 +1,4 @@ +{ "require":{ + "ezyang/htmlpurifier": "^4.12", + "swoole/ide-helper": "@dev" + } } diff --git a/getVideoTxt.php b/getVideoTxt.php index d835034..a9e8bdd 100644 --- a/getVideoTxt.php +++ b/getVideoTxt.php @@ -12,6 +12,8 @@ include 'cli/pachong.php'; +echo 111;die; + $redis = new Redis(); $redis->pconnect('127.0.0.1','6379'); diff --git a/suanfa/shunzi.php b/suanfa/shunzi.php new file mode 100644 index 0000000..00772da --- /dev/null +++ b/suanfa/shunzi.php @@ -0,0 +1 @@ + $value) { } } \ No newline at end of file diff --git a/suanfa/topk.php b/suanfa/topk.php new file mode 100644 index 0000000..31b0d35 --- /dev/null +++ b/suanfa/topk.php @@ -0,0 +1 @@ + $arr[$l]){ $tmp = $arr[$idx]; $arr[$idx] = $arr[$l]; $arr[$l] = $tmp; Heap($arr,$l); } } //这里为了保证跟上面一致,也构造500w不重复数 /* 当然这个数据集并不一定全放在内存,也可以在 文件里面,因为我们并不是全部加载到内存去进 行排序 */ ini_set('memory_limit', '1024M'); $numArr = range(0,5000000,1); //打乱它们 shuffle($numArr); //先取出10个到数组 $topArr = array_slice($numArr,0,10); //获取最后一个有子节点的索引位置 //因为在构造小顶堆的时候是从最后一个有左或右节点的位置 //开始从下往上不断的进行移动构造(具体可看上面的图去理解) $idx = floor(count($topArr) / 2) - 1; //生成小顶堆 for($i=$idx;$i>=0;$i--){ Heap($topArr,$i); } var_dump(microtime()); list($t1, $t2) = explode(' ', microtime()); $st = (float)sprintf('%.0f', floatval($t1) + floatval($t2)*1000); //这里可以看到,就是开始遍历剩下的所有元素 for($i = count($topArr); $i < count($numArr); $i++){ //每遍历一个则跟堆顶元素进行比较大小 if ($numArr[$i] > $topArr[0]){ //如果大于堆顶元素则替换 $topArr[0] = $numArr[$i]; /* 重新调用生成小顶堆函数进行维护,只不过这次是从堆顶 的索引位置开始自上往下进行维护,因为我们只是把堆顶 的元素给替换掉了而其余的还是按照根节点小于左右节点 的顺序摆放这也就是我们上面说的,只是相对调整下,并 不是全部调整一遍 */ Heap($topArr,0); } } var_dump($topArr); list($t1, $t2) = explode(' ', microtime()); $et = (float)sprintf('%.0f', floatval($t1) + floatval($t2)*1000); echo $et - $st; \ No newline at end of file diff --git a/test.php b/test.php index 4741650..1259f30 100644 --- a/test.php +++ b/test.php @@ -1 +1 @@ -x; }; // 闭包函数绑定到类 A 上 //$getX = $getXCB->bindTo(new A, 'A'); //echo $getX(); //print(PHP_EOL); echo $getXCB->call(new A, 'A'); \ No newline at end of file +connect('127.0.0.1',3306); die; class A { private $x = 1; } // PHP 7 之前版本定义闭包函数代码 $getXCB = function() { return $this->x; }; // 闭包函数绑定到类 A 上 //$getX = $getXCB->bindTo(new A, 'A'); //echo $getX(); //print(PHP_EOL); echo $getXCB->call(new A, 'A'); \ No newline at end of file diff --git a/xss.html b/xss.html deleted file mode 100644 index 69fde58..0000000 --- a/xss.html +++ /dev/null @@ -1 +0,0 @@ - xss漏洞广告页面 敏感词汇 \ No newline at end of file