首页
友情链接
关于我们
Search
1
Docker安装Chromium浏览器 - Docker里的浏览器
66 阅读
2
Docker 常用命令
52 阅读
3
Windows10添加共享网络打印机出现错误0x000004f8
27 阅读
4
Docker安装FRPS、FRPC
25 阅读
5
Docker安装网心云
21 阅读
Windows
Linux
Docker
源码代码
资源下载
登录
Search
陌路离殇
累计撰写
72
篇文章
累计收到
0
条评论
本站共
12.41 W
字
首页
栏目
Windows
Linux
Docker
源码代码
资源下载
页面
友情链接
关于我们
用户中心
登录
搜索到
22
篇与
源码代码
相关的结果
2024-12-05
PHP实现九九乘法口诀表
<?php for($i=1;$i<=9;$i++){ for($j=1;$j<=$i;$j++){ echo $j.'x'.$i.'='.$i*$j.' '; } echo '<br/>'; } ?>
2024年12月05日
3 阅读
0 评论
0 点赞
2024-11-29
PHP历史上的今天API
<?php //允许跨域 header("Access-Control-Allow-Origin:*"); $month=date( 'm',time() ); $day=date( 'd',time() ); //当前年月日 $today = date('Y年m月d日'); //获取接口数据 $url="https://baike.baidu.com/cms/home/eventsOnHistory/".$month.'.json'; $data = httpGet($url); $json = json_decode($data,true); //统计当日总数 $countnum = count($json[$month][$month.$day])-1; //获取输出数量(可以get调整) $num = $_GET['num'] ? $_GET['num'] : $countnum; $arr = array('code'=>'200','day'=>$today); for ($x=0; $x<=$num; $x++) { $arr['content'][$x].= match_chinese(strip_tags($json[$month][$month.$day][$x]['title'])); } //创建随机数 $rand = rand(0,$countnum); //下面是输出类型 if($_GET['format']=='json'){ //输出当日所有 类型为json header('Content-type: application/json'); echo json_encode($arr,JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT); }elseif($_GET['format']=='js'){ //以js类型输出一条 header('Content-type: text/javascript;charset=utf-8'); echo 'function briefing(){document.write("'.$arr['content'][$rand].'");}'; }else{ //以html类型输出一条 header("Content-Type: text/html;charset=utf-8"); echo $arr['content'][$rand]; } //下面是需要用到的封装 function httpGet($a, $b = '', $c = '', $d = ''){ //curl模拟get请求 $e = curl_init(); $f = mt_rand(11, 191) . "." . mt_rand(0, 240) . "." . mt_rand(1, 240) . "." . mt_rand(1, 240); $i[] = "CLIENT-IP:" . $f; $i[] = "X-FORWARDED-FOR:" . $f; $i[] = "User-agent:Mozilla/5.0 (Windows NT 6.1) AppleWebKit/536.11 (KHTML, like Gecko) Chrome/20.0.1132.57 Safari/536.11"; $i[] = "X-Requested-With: XMLHttpRequest"; if (!empty($d)) { $i[] = "Cookie: " . $d; } curl_setopt($e, CURLOPT_HTTPHEADER, $i); curl_setopt($e, CURLOPT_RETURNTRANSFER, true); curl_setopt($e, CURLOPT_TIMEOUT, 180); curl_setopt($e, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($e, CURLOPT_SSL_VERIFYHOST, false); if (!empty($c)) { curl_setopt($e, CURLOPT_REFERER, $c); } if (!empty($b)) { curl_setopt($e, CURLOPT_POST, 1); curl_setopt($e, CURLOPT_POSTFIELDS, $b); } curl_setopt($e, CURLOPT_URL, $a); curl_setopt($e, CURLOPT_ENCODING, "gzip"); $j = curl_exec($e); curl_close($e); return $j; } function match_chinese($chars,$encoding='utf8') { //清除正则 $pattern =($encoding=='utf8')?'/[\x{4e00}-\x{9fa5}a-zA-Z0-9]/u':'/[\x80-\xFF]/'; preg_match_all($pattern,$chars,$result); $temp =join('',$result[0]); return $temp; }
2024年11月29日
2 阅读
0 评论
0 点赞
2024-11-27
PHP获取网易云歌曲真实链接
<?php function getMusicUrl($songId) { $apiUrl = 'http://music.163.com/song/media/outer/url?id='.$songId.'.mp3'; $headers = array( 'Referer: http://music.163.com/', 'Host: music.163.com', 'User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36' ); $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $apiUrl); curl_setopt($ch, CURLOPT_VERBOSE, true); curl_setopt($ch, CURLOPT_HEADER, true); curl_setopt($ch, CURLOPT_NOBODY, true); curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'GET'); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_TIMEOUT, 20); curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); curl_setopt($ch, CURLOPT_AUTOREFERER, true); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false); $response = curl_exec($ch); $info = curl_getinfo($ch); $retURL = $info['url']; curl_close($ch); return $retURL; } ?>
2024年11月27日
4 阅读
0 评论
0 点赞
2024-11-26
PHP判断是IPv4还是IPv6
function isIPv4($ip) { return filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4) !== false; } function isIPv6($ip) { return filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_IPV6) !== false; } // 示例 $ip = '192.168.1.1'; if (isIPv4($ip)) { echo "这是IPv4地址"; } elseif (isIPv6($ip)) { echo "这是IPv6地址"; } else { echo "这不是有效的IPv4或IPv6地址"; }
2024年11月26日
2 阅读
0 评论
0 点赞
2024-11-24
跟随鼠标移动的燃烧火焰特效
<!doctype html> <html> <head> <meta charset="utf-8"> <title>火焰光标特效</title> <style> @import url(https://fonts.googleapis.com/css?family=Amatic+SC); html, body { margin:0; padding:0; height: 100%; overflow: hidden; } </style> </head> <body> <canvas id="fire"></canvas> <script> var Fire = function(){ this.canvas = document.getElementById('fire'); this.ctx = this.canvas.getContext('2d'); this.canvas.height = window.innerHeight; this.canvas.width = window.innerWidth; this.aFires = []; this.aSpark = []; this.aSpark2 = []; this.mouse = { x : this.canvas.width * .5, y : this.canvas.height * .75, } this.init(); } Fire.prototype.init = function() { this.canvas.addEventListener('mousemove', this.updateMouse.bind( this ), false); } Fire.prototype.run = function(){ this.update(); this.draw(); if( this.bRuning ) requestAnimationFrame( this.run.bind( this ) ); } Fire.prototype.start = function(){ this.bRuning = true; this.run(); } Fire.prototype.stop = function(){ this.bRuning = false; } Fire.prototype.update = function(){ this.aFires.push( new Flame( this.mouse ) ); this.aSpark.push( new Spark( this.mouse ) ); this.aSpark2.push( new Spark( this.mouse ) ); for (var i = this.aFires.length - 1; i >= 0; i--) { if( this.aFires[i].alive ) this.aFires[i].update(); else this.aFires.splice( i, 1 ); } for (var i = this.aSpark.length - 1; i >= 0; i--) { if( this.aSpark[i].alive ) this.aSpark[i].update(); else this.aSpark.splice( i, 1 ); } for (var i = this.aSpark2.length - 1; i >= 0; i--) { if( this.aSpark2[i].alive ) this.aSpark2[i].update(); else this.aSpark2.splice( i, 1 ); } } Fire.prototype.draw = function(){ this.ctx.globalCompositeOperation = "source-over"; this.ctx.fillStyle = "rgba( 15, 5, 2, 1 )"; this.ctx.fillRect( 0, 0, window.innerWidth, window.innerHeight ); this.grd = this.ctx.createRadialGradient( this.mouse.x, this.mouse.y - 200,200,this.mouse.x, this.mouse.y - 100,0 ); this.grd.addColorStop(0,"rgb( 15, 5, 2 )"); this.grd.addColorStop(1,"rgb( 30, 10, 2 )"); this.ctx.beginPath(); this.ctx.arc( this.mouse.x, this.mouse.y - 100, 200, 0, 2*Math.PI ); this.ctx.fillStyle= this.grd; this.ctx.fill(); this.ctx.font = "15em Amatic SC"; this.ctx.textAlign = "center"; this.ctx.strokeStyle = "rgb(50, 20, 0)"; this.ctx.fillStyle = "rgb(120, 10, 0)"; this.ctx.lineWidth = 2; this.ctx.strokeText("Fire",this.canvas.width/2, this.canvas.height * .72 ); this.ctx.fillText("Fire",this.canvas.width/2, this.canvas.height * .72 ); this.ctx.globalCompositeOperation = "overlay";//or lighter or soft-light for (var i = this.aFires.length - 1; i >= 0; i--) { this.aFires[i].draw( this.ctx ); } this.ctx.globalCompositeOperation = "soft-light";//"soft-light";//"color-dodge"; for (var i = this.aSpark.length - 1; i >= 0; i--) { if( ( i % 2 ) === 0 ) this.aSpark[i].draw( this.ctx ); } this.ctx.globalCompositeOperation = "color-dodge";//"soft-light";//"color-dodge"; for (var i = this.aSpark2.length - 1; i >= 0; i--) { this.aSpark2[i].draw( this.ctx ); } } Fire.prototype.updateMouse = function( e ){ this.mouse.x = e.clientX; this.mouse.y = e.clientY; //this.aFires.push( new Flame( this.mouse ) ); } var Flame = function( mouse ){ this.cx = mouse.x; this.cy = mouse.y; this.x = rand( this.cx - 25, this.cx + 25); this.y = rand( this.cy - 5, this.cy + 5); this.vy = rand( 1, 3 ); this.vx = rand( -1, 1 ); this.r = rand( 20, 30 ); this.life = rand( 3, 6 ); this.alive = true; this.c = { h : Math.floor( rand( 2, 40) ), s : 100, l : rand( 80, 100 ), a : 0, ta : rand( 0.8, 0.9 ) } } Flame.prototype.update = function() { this.y -= this.vy; this.vy += 0.05; this.x += this.vx; if( this.x < this.cx ) this.vx += 0.1; else this.vx -= 0.1; if( this.r > 0 ) this.r -= 0.1; if( this.r <= 0 ) this.r = 0; this.life -= 0.15; if( this.life <= 0 ){ this.c.a -= 0.05; if( this.c.a <= 0 ) this.alive = false; }else if( this.life > 0 && this.c.a < this.c.ta ){ this.c.a += .08; } } Flame.prototype.draw = function( ctx ){ ctx.beginPath(); ctx.arc( this.x, this.y, this.r * 3, 0, 2*Math.PI ); ctx.fillStyle = "hsla( " + this.c.h + ", " + this.c.s + "%, " + this.c.l + "%, " + (this.c.a/20) + ")"; ctx.fill(); ctx.beginPath(); ctx.arc( this.x, this.y, this.r, 0, 2*Math.PI ); ctx.fillStyle = "hsla( " + this.c.h + ", " + this.c.s + "%, " + this.c.l + "%, " + this.c.a + ")"; ctx.fill(); } var Spark = function( mouse ){ this.cx = mouse.x; this.cy = mouse.y; this.x = rand( this.cx -40, this.cx + 40); this.y = rand( this.cy, this.cy + 5); this.lx = this.x; this.ly = this.y; this.vy = rand( 1, 3 ); this.vx = rand( -4, 4 ); this.r = rand( 0, 1 ); this.life = rand( 4, 5 ); this.alive = true; this.c = { h : Math.floor( rand( 2, 40) ), s : 100, l : rand( 40, 100 ), a : rand( 0.8, 0.9 ) } } Spark.prototype.update = function() { this.lx = this.x; this.ly = this.y; this.y -= this.vy; this.x += this.vx; if( this.x < this.cx ) this.vx += 0.2; else this.vx -= 0.2; this.vy += 0.08; this.life -= 0.1; if( this.life <= 0 ){ this.c.a -= 0.05; if( this.c.a <= 0 ) this.alive = false; } } Spark.prototype.draw = function( ctx ){ ctx.beginPath(); ctx.moveTo( this.lx , this.ly); ctx.lineTo( this.x, this.y); ctx.strokeStyle = "hsla( " + this.c.h + ", " + this.c.s + "%, " + this.c.l + "%, " + (this.c.a / 2) + ")"; ctx.lineWidth = this.r * 2; ctx.lineCap = 'round'; ctx.stroke(); ctx.closePath(); ctx.beginPath(); ctx.moveTo( this.lx , this.ly); ctx.lineTo( this.x, this.y); ctx.strokeStyle = "hsla( " + this.c.h + ", " + this.c.s + "%, " + this.c.l + "%, " + this.c.a + ")"; ctx.lineWidth = this.r; ctx.stroke(); ctx.closePath(); } rand = function( min, max ){ return Math.random() * ( max - min) + min; }; onresize = function () { oCanvas.canvas.width = window.innerWidth; oCanvas.canvas.height = window.innerHeight; }; var oCanvas; init = function() { oCanvas = new Fire(); oCanvas.start(); } window.onload = init; </script> </body> </html>
2024年11月24日
2 阅读
0 评论
0 点赞
1
2
...
5