php 简单file_get_contents fopen教程
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
</head>
<body>
<?php
$content =file_get_contents('http://down.111cn.net/');
if( !empty( $content ) ){
$info = fopen('down.txt','w+');
fwrite($info,$content);
fclose($info);
print_r(file('down.txt') );
}
?>
</body>
</html>
<?php
$d ='2009-07-02 09:09:00';
echo date("Y-m-d",'1246606382');
echo date('Ymd',dateToTime($d));
$temp = dateToTime($d);
echo $temp;
echo date("Y-m-d",$temp);
function dateToTime($d)
{
$year=((int)substr("$d",0,4));//取得年份
$month=((int)substr("$d",5,2));//取得月份
$day=((int)substr("$d",8,2));//取得几号
return mktime(0,0,0,$month,$day,$year);
}
?>
<?php
require_once (dirname(__FILE__) . "/include/common.inc.php");
require_once(DEDEINC."/channelunit.class.php");
$aid = (isset($aid) && is_numeric($aid)) ? $aid : 0;
$rand =mt_rand(10,80);
$query = "select count(*) as dd from #@__downloads where id='$aid'";
$row = $dsql->GetOne($query);
if($row['dd'] > 0)
{
$query = "update #@__downloads set downloads=downloads+$rand where id='$aid'";
$dsql->ExecNoneQuery($query);
}else {
$query = "insert into #@__downloads(hash,id,downloads) values('null$aid','$aid',1)";
$dsql->ExecNoneQuery($query);
}
下面是实例方法。
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<script src="http://pstatic.xunlei.com/js/webThunderDetect.js"></script>
<script src="http://pstatic.xunlei.com/js/base64.js"></script>
<script language="javascript" type="text/javascript">
var xmlHttp = false;
function ajaxcreate(){
try {
xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
try {
xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
} catch (e2) {
xmlHttp = false;
}
}
if (!xmlHttp && typeof XMLHttpRequest != 'undefined') {
xmlHttp = new XMLHttpRequest();
}
if(!xmlHttp){alert('Create Xmlhttp Fail ');return false;}
}
function ajax_add(){
ajaxcreate();
var url="/ajax_down.php?aid="+encodeURI(5396)+"&rd="+Math.random();
xmlHttp.open("POST",url,true);
xmlHttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
xmlHttp.send(null);
}
</script>
<title>绿色版Apache+Php+Mysql V1.3 自动安装版_下载地址列表_网站源码下载-整站源码下载-站长常用工具下载</title>
<link href="/templets/style/search.css" rel="stylesheet" type="text/css" media="screen" />
</head>
<body>
<div class="header">
<div class="toplogo">
<h1><a href="http://down.111cn.net/">网站源码下载-整站源码下载-站长常用工具下载</a></h1>
</div>
</div>
<div class="msgbar">
<p>
<strong>软件名称:<a href='/down/soft/server/2009/0629/5396.html'>绿色版Apache+Php+Mysql V1.3 自动安装版</a></strong>
</p>
</div>
<div class="advancedsearch">
<table width="100%" border="0" align="center" cellspacing="2">
<tr>
<td height="30" bgcolor="#F2F7E6">下载地址列表:</td>
</tr>
<tr>
<td height="78"><script language="javascript" src="/js/gg_bottom.js"></script>
<a href="#" class="red" thunderHref="thunder://QUFodHRwOi8vemp0ZWxlNC5za3ljbi5jb20vZG93bi9nZ2dBUE1zZXJ2ZXIuemlwWlo=" thunderPid="85957" thunderType="" thunderResTitle="" onClick="ajax_add();return OnDownloadClick_Simple(this,2);" oncontextmenu="ThunderNetwork_SetHref(this)" >[迅雷专用下载]</a>
<script type="text/javascript"><!--
google_ad_client = "pub-6219414158063594";
/* 336x280, 创建于 09-3-29 */
google_ad_slot = "8019903307";
google_ad_width = 336;
google_ad_height = 280;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
<script type="text/javascript"><!--
google_ad_client = "pub-6219414158063594";
google_ad_format = "configurable_sdo";
google_link_target = 2;
google_color_bg = "ffffff";
google_color_link = "000000";
google_color_text = "000000";
google_encoding = "GB2312";
google_ad_channel = "5161927073";
google_box_len = 40;
google_logo_pos = "left";
google_rs_pos = "below";
google_ad_height = 65;
google_ad_width = 500;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_sdo.js">
</script>
</td>
</tr>
</table>
</div>
<div class="footer">
<p class="link">
网站版权信息及免责声明
</p>
<p class="powered">
Copyright <a href="http://down.111cn.net" title="" target="_blank"><strong>down.<span>111cn.net</span></strong></a> © 2004-2008 Inc.
<script language="javascript" src="/js/count.js"></script>
</p><!-- /powered -->
</div>
<div id="tt" ></div>
</body>
</html>
文章为各位提供一个哦,如果喜欢就行了。
<?php
if(!defined('DEDEINC'))
{
exit("Request Error!");
}
function SpHtml2Text($str)
{
$str = preg_replace("/<sty(.*)\/style>|<scr(.*)\/script>|<!--(.*)-->/isU","",$str);
$alltext = "";
$start = 1;
for($i=0;$i<strlen($str);$i++)
{
if($start==0 && $str[$i]==">")
{
$start = 1;
}
else if($start==1)
{
if($str[$i]=="<")
{
$start = 0;
$alltext .= " ";
}
else if(ord($str[$i])>31)
{
$alltext .= $str[$i];
}
}
}
$alltext = str_replace(" "," ",$alltext);
$alltext = preg_replace("/&([^;&]*)(;|&)/","",$alltext);
$alltext = preg_replace("/[ ]+/s"," ",$alltext);
return $alltext;
}
?>
php 字符截取与图片过滤函数本文章免费为各位朋友提供一款哦,如果你喜欢的话不防进来看看这款图片过滤正则表达试
function msubstr($str, $start, $len) {
$tmpstr = "";
$strlen = $start + $len;
for($i = 0; $i < $strlen; $i++) {
if(ord(substr($str, $i, 1)) > 0xa0) {
$tmpstr .= substr($str, $i, 2);
$i++;
} else
$tmpstr .= substr($str, $i, 1);
}
return $tmpstr;
}
//过滤图片
function img_empty($content){
$content=eregi_replace("<IMG ([a-zA-Z0-9~!& ?:"/._#=~&%]+)>","",$content);
return $content;
}
相关文章
- 今天小编在这里就来给Painter的这一款软件的使用者们来说一说绘制红衣喝酒男水粉画效果的教程,各位想知道具体绘制步骤的使用者,那么下面就快来跟着小编一起看一看教程...2016-09-14
iPhone6怎么激活?两种苹果iPhone6激活教程图文详解
iPhone6新机需要激活后才可以正常使用,那么对于小白用户来说,iPhone6如何激活使用呢?针对此问题,本文就为大家分别介绍Wifi无线网络激活以及iPhone6连接电脑激活这两种有效的方法,希望本文能够帮助到大家...2022-09-14- 今天小编在这里就来给各位photoshop的这一款软件的使用者们来说下制作雨中野外孤独行走的一头牛海报的教程,各位想知道具体制作方法的使用者们,大家就快来看一看小编给...2016-09-14
- 今天小编在这里就来给Painter的这一款软件的使用者们来说一下绘制帅气卡通魔法王子漫画的具体教程,各位想知道绘制步骤的使用者,那么下面就快来跟着小编一起看一看教程...2016-09-14
- 今天小编在这里就来给各位Illustrator的这一款软件的使用者们来说说鼠绘堆雪人的孩童矢量插画的教程,各位想知道具体绘制方法的使用者们,那么各位就快来跟着小编来看看...2016-09-14
- 今天小编在这里就来给美图秀秀的这一款软件的使用者们来说下究竟该怎么给照片天空加蓝天白云的教程,各位想知道具体制作步骤的,那么下面就来跟着小编一起看看吧。 ...2016-09-14
- 支付宝支付在国内算是大家了,我们到处都可以使用支付宝了,下文整理介绍的是在安卓app应用中使用支付宝进行支付的开发例子。 之前讲了一篇博客关与支付宝集成获取...2016-09-20
- 今天小编在这里就来给llustrator的这一款软件的使用者们来说一说绘制扁平化风格卡通警察护士空姐肖像的教程,各位想知道具体绘制步骤的使用者们,那么下面就快来跟着小编...2016-09-14
- 今天小编在这里就来给Illustrator的这一款软件的使用者们来说一下绘制一个方形的录音机图标的教程,各位想知道具体绘制方法的使用者们,那么下面就来看一下小编给大家分...2016-09-14
- 今天小编在这里就来给photoshop的这一款软件的使用者们来说一说简单制作一个搞笑的换脸表情包的教程,各位想知道具体制作方法的使用者们,那么大家就快来看一看教程吧。...2016-09-14
php 中file_get_contents超时问题的解决方法
file_get_contents超时我知道最多的原因就是你机器访问远程机器过慢,导致php脚本超时了,但也有其它很多原因,下面我来总结file_get_contents超时问题的解决方法总结。...2016-11-25- 今天小编在这里就来给各位photoshop的这一款软件的使用者们来说说给手绘画调色变换场景的后期教程,各位想知道具体后期处理步骤的使用者们,那么大家就快来跟着小编来看...2016-10-02
- 今天小编在这里就来给美图秀秀的这一款软件的使用者们来说一下让你胸丰满起来的处理教程,各位想知道具体处理步骤的,那么下面就快来跟着小编一起看一下教程吧。 给...2016-09-14
- 今天小编在这里就来给Painter的这一款软件的使用者们来说一下绘制雷神传插画的教程,各位想知道具体绘制步骤的使用者,那么下面就快来跟着小编一起看看绘制方法吧。 ...2016-09-14
php file_get_contents 设置代理抓取页面示例
file_get_contents函数在php中可以直接打开本地文件也可以直接抓取远程服务器文件,如果简单的采集我们可以使用file_get_contents直接来操作,如果有防采集我们可能需要...2016-11-25- 联合索引又叫复合索引。对于复合索引:Mysql从左到右的使用索引中的字段,一个查询可以只使用索引中的一部份,但只能是最左侧部分。例如索引是key index (a,b,c). 可以支持a | a,b| a,b,c 3种组合进行查找,但不支持 b,c进...2015-11-24
- 今天小编在这里就来给美图秀秀的这一款软件的使用者们来说下制作隔离区聊天背景的教程,各位想知道具体方法的,那么下面就快来跟着小编一起看一看吧。 给各位美图秀...2016-09-14
- 一、下载 mysqlsla [root@localhost tmp]# wget http://hackmysql.com/scripts/mysqlsla-2.03.tar.gz--19:45:45-- http://hackmysql.com/scripts/mysqlsla-2.03.tar.gzResolving hackmysql.com... 64.13.232.157Conn...2015-11-24
- 这篇文章主要给大家介绍的是关于Lua语言新手入门的简单教程,文中通过示例代码一步步介绍的非常详细,对各位新手们的入门提供了一个很方便的教程,需要的朋友可以参考借鉴,下面随着小编来一起学习学习吧。...2020-06-30
php报错file_get_contents(): php_network_getaddresses问题
本文章来为各位介绍一篇关于file_get_contents(): php_network_getaddresses: getaddrinfo failed: Name or service not known...错误解决办法。 昨天,服务器的DN...2016-11-25