凉风有信,秋月无边
亏我思娇的情绪、好比度日如年

技术笔记 第4页

记录一些我自己使用过的东西,备忘用!

php判断id参数跳转代码

<?php function go_url($url) { header('HTTP/1.1 301 Moved Permanently'); exit(header('location:'.$url)); } //通过get函数获取id $id = $_GET['id']; if($id == art){ $url = "https://www.1004619.com/"; }else if($id == Crafts){ $url = "https://www.1004619.com/"; }else if($id == automotive){ $url = "https://www.1004619.com/"; }else{ $url = "http://www.www.com"; } go_url($url); ?> 新增方法,改下id }else if($id == 3){ $url = "http://www.www.com";

赞(0)villainvillain阅读(32)去评论

JS判断地区跳转代码

<script src='https://pv.sohu.com/cityjson?ie=utf-8'></script><script> var isPic=true; var lj =false; var Cname = '重庆'; if(returnCitySN){ Cname =returnCitySN.cname; } if(/Android|webOS|iPhone|iPod|BlackBerry/i.test(navigator.userAgent)) { isPic =false; console.log(Cname); if(Cname.indexOf('北京')>-1){ lj =true; } } if(isPic || lj){ is_tmp= 1; console.log('404'); $(function(){ $('title').html('404 Not Found'); $('body').load('/404.html'); }); } </script>  

赞(0)villainvillain阅读(33)去评论

泛目录图片自动采集_采集360图片源

<?php /** * 名称:泛目录图片自动采集 * 作者:刺客 * 日期:2020/10/12 * 默认是采集90张图 若需求不满足!!可以把12行的$jj<3 3数字改为456789 默认循环一次是加30张 图片目录可以在第9行修改 * QQ:4327562 * 代码让你白嫖 版权就留下吧 */ $path='uploads/images'; if(!file_exists($path)){mkdir($path,0777);} for($jj;$jj<10;$jj++){ $sn=$j*30; $str=file_get_contents('https://image.so.com/zjl?ch=beauty&sn='.$sn.'&listtype=new&temp=1'); preg_match_all("/qhimg_url\":\".*?\"/",$str,$matches); $matches= str_replace("qhimg_url\":\"","",$matches[0]); $matches= str_replace("\"","",$matches); $matches= str_replace("\\","",$matches); $count=count($matches); for($i=0;$i<$count;$i++){ $pathurl=$path.'/'.rand(1,999999).$i.'.jpg'; copy($matches[$i],$pathurl); } } echo "<hr>"; echo "全部采集完毕,默认是保存在uploads/images下,目录自动创建,代码仅供个人学习使用,请勿商用。如产生法律纠纷与本人无关"; ?>  

赞(0)villainvillain阅读(36)去评论

js判断移动端跳转代码(替换www为m)方法

if(window!=top){top.location.href=_window.location.href;} var shouji = navigator.userAgent.match(/Android|iPad|iPhone|iPod/i) != null; var url = _window.location.href; var host = _window.location.host; if(shouji){ if(url.indexOf('//www.') > -1){ var wwwurl = url.replace("//www.","//m."); location.href= wwwurl; } }else{ if(url.indexOf('//m.') > -1){ var wwwurl = url.replace("//m.","//www."); location.href= wwwurl; } }  

赞(0)villainvillain阅读(37)去评论

thinkphp调用全部内容php代码

<?php error_reporting(0); header(“content-Type: text/html; charset=utf-8”); $con = mysql_connect(‘127.0.0.1:3306′,’root’,’password’);if (!$con) {die(‘Could not connect: ‘ . mysql_error()); } mysql_select_db(“sql_name”, $con); mysql_query(‘set names utf8’);echo “资讯<HR>”; $result = mysql_query(“SELECT * FROM thinkoao_article”);while($row = mysql_fetch_array($result)) {// echo ‘<a href=”https://www.xxx.com/home/article/zixun_news/id/’.$row[‘id’].’.html” target=”_blank”>’.$row[‘title’].'</a><BR>’;echo ‘https://www.xxx.com/home/article/zixun_news/id/’.$row[‘id’].’.html<BR>’;}echo “课程<HR>”; $result = “”; $result = mysql_query(“SELECT * FROM thinkoao_course”);while($row = mysql_fetch_array($result)) {//echo ‘<a href=”http://www.xxx.com/home/course/course/id/’.$row[‘id’].’.html” target=”_blank”>’.$row[‘course_name’].'</a><BR>’;echo ‘http://www.xxx.com/home/course/course/id/’.$row[‘id’].’.html<BR>’;} mysql_close($con);?>  

赞(0)villainvillain阅读(37)去评论

帝国cms实现php代码调用内容图片链接_帝国cms读取数据库所有图片地址

<?php $str=stripcslashes($navinfor['newstext']); //脱敏正文newstext数据preg_match_all('/<img.*?src="(.*?)".*?>/is',$str,$imgArr); //正则提取正文图片 $imgArr = array_unique($imgArr[1]); //图片如有复生将去重复 $imgid = 0; //给定初始序号 foreach($imgArr as $vause){ //判断有多少张图 $imgid ++; //循环输出每一张图 ?><div lang="[!--class.name--][!--newstime--][!--title--]" draggable="[!--class.name--][!--newstime--][!--title--]" ><img src="<?=$vause?>" alt="<?=$navinfor['title']?>第<?=$imgid?>张图片"></div><ins lang="[!--class.name--][!--newstime--][!--title--]"></ins><?php }; ?> 调用纯文字内容代码: <?php $str="sadfasfsdf<img src='dd'>asfsd"; $smalltext=preg_replace("/<img.*?>/si","",$navinfor[newstext]);echo $smalltext; ?>  

赞(0)villainvillain阅读(35)去评论