简单的讲:
file读取文件以数组形式返回,file_get_contents读取文件以字符串形式返回!
比如读取一个data.txt的文本文件。
- <?php
- $file=file(“data.txt”);
- $file_get_contents=file_get_contents(“data.txt”);
- echo “file 数组,一行一个!<br><br>”;
- print_r($file);
- echo “<br><hr>file_get_contents,字符串。<br><br>”;
- print_r($file_get_contents);
- ?>
输出:
- file 数组,一行一个!
- Array ( [0] => 第一行 [1] => 第二行 [2] => 第三行 )
- file_get_contents,字符串。
- 第一行 第二行 第三行
图:
如果以txt做数据的话,utf-8编码要把txt也保存为utf-8的文本文件!
一个很有趣的CSS3动画效果
一个很有趣的CSS3动画效果,可当过渡页,如loading!
完整代码:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<meta name="viewport" content="width=device-width,height=device-height, initial-scale=1.0, user-scalable=no" />
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="robots" content="noindex,follow">
<title>加载中</title>
<style>
body{font-weight:100;margin:0}body{-webkit-tap-highlight-color:transparent;background-color:#222428;font-size:100%;font-family:Open Sans;height:100%}.loader{top:50%;left:50%;-webkit-transform:translate(-50%,-50%);-mos-transform:translate(-50%,-50%);transform:translate(-50%,-50%);text-align:center;-webkit-touch-callout:none;-webkit-user-select:none;-khtml-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;cursor:default;width:80%;overflow:visible}.loader,.loader div{position:absolute;height:36px}.loader div{width:30px;margin:0 10px;opacity:0;animation:move 2s linear infinite;-o-animation:move 2s linear infinite;-moz-animation:move 2s linear infinite;-webkit-animation:move 2s linear infinite;transform:rotate(180deg);-o-transform:rotate(180deg);-moz-transform:rotate(180deg);-webkit-transform:rotate(180deg);color:#fff;font-size:3em}.loader div:nth-child(8):before{background:#db2f00}.loader div:nth-child(8):before,.loader div:nth-child(9):before{content:'';position:absolute;bottom:-15px;left:0;width:30px;height:30px;border-radius:100%}.loader div:nth-child(9):before{background:#f2f2f2}.loader div:nth-child(10):before{bottom:-15px;height:30px;background:#13a3a5}.loader div:after,.loader div:nth-child(10):before{content:'';position:absolute;left:0;width:30px;border-radius:100%}.loader div:after{bottom:-40px;height:5px;background:#39312d}.loader div:nth-child(2){animation-delay:.2s;-o-animation-delay:.2s;-moz-animation-delay:.2s;-webkit-animation-delay:.2s}.loader div:nth-child(3){animation-delay:.4s;-o-animation-delay:.4s;-webkit-animation-delay:.4s}.loader div:nth-child(4){animation-delay:.6s;-o-animation-delay:.6s;-moz-animation-delay:.6s;-webkit-animation-delay:.6s}.loader div:nth-child(5){animation-delay:.8s;-o-animation-delay:.8s;-moz-animation-delay:.8s;-webkit-animation-delay:.8s}.loader div:nth-child(6){animation-delay:1s;-o-animation-delay:1s;-moz-animation-delay:1s;-webkit-animation-delay:1s}.loader div:nth-child(7){animation-delay:1.2s;-o-animation-delay:1.2s;-moz-animation-delay:1.2s;-webkit-animation-delay:1.2s}.loader div:nth-child(8){animation-delay:1.4s;-o-animation-delay:1.4s;-moz-animation-delay:1.4s;-webkit-animation-delay:1.4s}.loader div:nth-child(9){animation-delay:1.6s;-o-animation-delay:1.6s;-moz-animation-delay:1.6s;-webkit-animation-delay:1.6s}.loader div:nth-child(10){animation-delay:1.8s;-o-animation-delay:1.8s;-moz-animation-delay:1.8s;-webkit-animation-delay:1.8s}@keyframes move{0%{right:0;opacity:0}35%{right:41%}35%,65%{-webkit-transform:rotate(0);transform:rotate(0);opacity:1}65%{right:59%}to{right:100%;-webkit-transform:rotate(-180deg);transform:rotate(-180deg)}}@-webkit-keyframes move{0%,to{opacity:0}0%{right:0}35%{right:41%}35%,75%{-webkit-transform:rotate(0);transform:rotate(0);opacity:1}75%{right:59%}to{right:100%;-webkit-transform:rotate(-180deg);transform:rotate(-180deg);opacity:0}}
</style>
</head>
<body class="ie8">
<div class="loader">
<div> C </div>
<div> S </div>
<div> S </div>
<div> 动 </div>
<div> 画 </div>
<div> 吗 </div>
<div> ? </div>
<div> </div>
<div> </div>
<div> </div>
</div>
</body>
</html>
演示地址:效果演示
代码
·
JOS京东联盟API接口调用
突然突然突然,觉得做一个京东联盟API调用,也许,在微信QQ等场景是不会有被屏蔽的现象。
于是于是于是,就去研究了下京东联盟API,看着一堆接口,描述的确挺不错的,实际返回内容,可能不是你想的那样。。。
另外另外另外,京东联盟的API调用是需要一个token授权的,而且,这个token授权还需要登陆京东账户的,好在这个token的有效期是1年,在1年内,登陆一次就好!据说,修改过京东账户密码,是需要重新获取一次的!
好吧好吧好吧,那就来获取token授权码,想获取token,先得获取code,通过code,再获取token!
先看下官方说明:
再看下获取授权码的API请求链接:
https://oauth.jd.com/oauth/authorize?response_type=code&client_id=YOUR_CLIENT_ID&
redirect_uri=YOUR_REGISTERED_REDIRECT_URI&state=YOUR_CUSTOM_CODE
对着参数列表,链接是这样的!
https://oauth.jd.com/oauth/authorize?response_type=code&client_id=你的Appkey&
redirect_uri=你的回调URL&state=随意写
改好后,复制黏贴到浏览器打开,就是一个授权登陆,登陆之后自动跳转到回调地址,参数中带有code值!
通过code值获取token,获取token值请求地址:
https://oauth.jd.com/oauth/token?grant_type=authorization_code&client_id=你的Appkey&
redirect_uri=你的回调URL&code=刚刚获取的code&state=随意写&client_secret= 你的appSecret
复制到浏览器打开,就可以获得需要的token。
另外,有一个叫做Refresh token的刷新token来延迟Access token的时效,也就是,如果获取一次,可以在有效期内延长时间,比如计划!
获取了Access token之后,就可以使用API接口了!
最后,只想说,京东联盟的API,始终没有阿里妈妈API来的方便!
参考官方文档://jos.jd.com/doc/channel.htm?id=152
代码
·
让position:absolute超出DIV溢出隐藏
通常,为了让DIV子元素超出部分隐藏,都是在父元素设置overflow:hidden,这样即可防止子元素撑开父元素,使子元素能够溢出隐藏!
但是,对于position:absolute定位的子元素,仅仅使用overflow:hidden没办法将其溢出部分隐藏,需要在父元素上也加上一个定位position:relative;才能将含有 position:absolute属性的子元素进行溢出隐藏!
效果:
代码:
<style>
.box{
width:200px;
height:150px;
overflow:hidden;
border:2px solid #000;
float:left;
margin-right:20px;
}
.relative{
position:relative;
}
.div{
width:200px;
height:100px;
background:#FF5400;
margin-top:100px;
position:absolute;
}
.zi{
width:200px;
height:300px;
background:#FF0000;
}
</style>
<div class=“box”>
高300px的子元素溢出隐藏
<div class=“zi”></div>
</div>
<div class=“box”>
不带relative
<div class=“div”></div>
</div>
<br><br><br><br><br><br>
<div class=“box relative”>
带上relative
<div class=“div”></div>
</div>
附:
1、CSS overflow属性,overflow 属性规定当内容溢出元素框时发生的事情,所有主流浏览器都支持 overflow 属性。任何的版本的 Internet Explorer (包括 IE8)都不支持属性值 “inherit”。
这个属性定义溢出元素内容区的内容会如何处理。如果值为 scroll,不论是否需要,用户代理都会提供一种滚动机制。因此,有可能即使元素框中可以放下所有内容也会出现滚动条。 默认值:visible
hidden:内容会被修剪,并且其余内容是不可见的。
scroll:内容会被修剪,但是浏览器会显示滚动条以便查看其余的内容。
auto:如果内容被修剪,则浏览器会显示滚动条以便查看其余的内容。
inherit:规定应该从父元素继承 overflow 属性的值。
2、position属性,position 属性规定元素的定位类型。所有主流浏览器都支持 position 属性。任何的版本的 Internet Explorer (包括 IE8)都不支持属性值 “inherit”。
这个属性定义建立元素布局所用的定位机制。任何元素都可以定位,不过绝对或固定元素会生成一个块级框,而不论该元素本身是什么类型。相对定位元素会相对于它在正常流中的默认位置偏移。默认值:static
absolute:生成绝对定位的元素,相对于 static 定位以外的第一个父元素进行定位。元素的位置通过 “left”, “top”, “right” 以及 “bottom” 属性进行规定。
fixed:生成绝对定位的元素,相对于浏览器窗口进行定位。元素的位置通过 “left”, “top”, “right” 以及 “bottom” 属性进行规定。
relative:生成相对定位的元素,相对于其正常位置进行定位。因此,”left:20″ 会向元素的 LEFT 位置添加 20 像素。
static:默认值。没有定位,元素出现在正常的流中(忽略 top, bottom, left, right 或者 z-index 声明)。
inherit:规定应该从父元素继承 position 属性的值。
代码
·
淘点金href值
最近一段时间,写一个淘点金店铺的集合页(//mall.moutaowang.com),在写链接的时候希望A标签能有站内链接href值,同时又需要点击能直接跳转淘点金链接!按照搜索引擎的观点,站内链接能提高爬虫,实际点击的效果是跳转到淘点金生成的链接!
部署完淘点金链接之后,发现如果有站内href值,淘点金无法生效,移除href值淘点金能成功生效。
淘点金组件部署:
<a biz-sellerid=“1753012236” isconvert=“1” href=“//mall.moutaowang.com/shop/29-1.html” target=“_blank”>申美盛旗舰店</a>
淘点金click组件,需要两个属性biz-sellerid和isconvert
带有href值的直接链接到href的链接,不带href就可以链接到淘客链接!搜索引擎对JS无视,利用JQ过滤href值。
$(“a[isconvert^=’1′]”).each(function(i){
$(this).removeAttr(“href”);
$(this).css(‘cursor’,’pointer’);
这样,查找 isconvert属性的A标签移出href,这样右击查看属性,地址(URL)就是淘点金生成的淘客链接了!
查看源码,href值就是站内的链接!
因为使用JQ,所以要在文档中引入JQ库!
代码
·
Zero零分
站龄14年资深站长
一个喜欢折腾,却又折腾不出像样东西的,不会PHP的PHP程序员!
474
文章 26
评论 27
分类 839
标签 7
友链
文章 26
评论 27
分类 839
标签 7
友链
百度广告
最近更新
- 01 微信小程序开发新版本检测、网络请求、json格式判断封装
- 02 利用Fiddler抓包工具下载微信视频号视频
- 03 整理了一张吴宗宪专辑无损CD《无尽的爱》APE格式音频
- 04 百度AI语音演示接口后获取的音频流处理
- 05 Win7 安装pr2018(AdobePremiereCC2018)记录说明
- 06 win7无法查看gif动画图解决插件Image_Viewer_for_Windows_7
- 07 win7 视频无法预览图片(文件夹内不显示略缩图)
- 08 微信小程序解决上滑多次加载重复内容的问题
- 09 图片处理软件Fireworks CS6
- 10 win10水星USB无线网卡创建移动热点,提示我们无法设置移动热点解决方案
热门推荐
最新评论
标签云
微信小程序
小程序开发
视频下载
Fiddler
微信视频号
无损CD
无尽的爱
吴宗宪
文字转语音
百度ai
pr2018
win7
Image Viewer for Windows 7
win7查看GIF
视频预览图片
视频略缩图
视频解码器
fireworks
水星
移动热点
ps ico
ps插件
foreach
php
保存远程图片
登录过期
phpmyadmin
扩展屏
多显示器
自动登陆
netplwiz
CSS动画
wordpress图片
sitemap
无线端
调试
a标签
P标签
calc
justify
pycharm
Python
相邻文章
logo
赵薇
html
win11
Windows
扫黑风暴
我的饭店
淘花
游艇
港姐
周星驰
unisoc
荣耀paly5
信用卡
AI机器人
华智冰
小冰
评论功能已经关闭!