Jul202012
获取网页内容的方法吧 欢迎指教
//file_get_contents
<?php
$url = "http://www.120sc.com";
$contents = file_get_contents($url);
//如果出现中文乱码使用下面代码 mb_convert_string();
//$getcontent = iconv("gb2312", "utf-8",$contents);
echo $contents;
?>
//curl
<?php
$url = "http://www.120sc.com";
$ch = curl_init();
$timeout = 5;
curl_setopt($ch, CURLOPT_UR...阅读全文
作者:绝缘体.. | 分类:PHP | 阅读: |
抢沙发
Jun092012
php日志记录类
php日志记录类
<?php
/**********************************************************
* File name: LogsClass.class.php
* Class name: 日志记录类
* Create date: 2008/05/14
* Update date: 2008/09/28
* Author: blue
* Description: 日志记录类
* Example: //设定路径和文件名
* $dir="a/b/".date("Y/m",time());
* $filename=date("d",time()).".log";
* $log...阅读全文
May072012
百度自动ping功能javascript和php代码
百度自动ping功能javascript和php代码
百度自动ping功能对SEO有不少帮助,在这收藏一下百度官方页的javascript代码和PHP代码.
百度官方的ping功能javascript代码:
<script>
function pin(url,value){
var request = null;
try{
var request=new XMLHttpRequest();
}
catch(e){}
if(request==null) try {
request = new ActiveXOb...阅读全文
May032012
将DedeCMS根目录下的data目录迁移到web以外目录方法
data目录是系统缓存和配置文件的目录,一般都有可以读写的权限,只要是能够写入的目录都可能存在安全隐患,很多站长甚至给予这个目录可执行的权限,更是非常危险,所以我们建议将这个data目录搬移出Web可访问目录之外。本篇将介绍如何将data目录搬移出Web访问目录。
注意:
本操作需要用户对DedeCMS系统有较高的了解,如果您感觉自己不太掌握,可以考虑选择织梦管理员之家的相关服务。点击查...阅读全文
May012012
Apr292012
dedecms5.6数据库内容升级dede5.7
TRUNCATE `dede_addonarticle`;
TRUNCATE `dede_archives`;
TRUNCATE `dede_arctiny`;
TRUNCATE `dede_arctype`;
insert into dedecmsv57utf8sp1.dede_addonarticle select * from gk_fuke999_org.fuke999org_addonarticle;
insert into dedecmsv57utf8sp1.dede_archives select * from gk_fuke999_org.fuke999org_archives;
insert into dedecmsv57utf8sp1.dede_arctiny select *...阅读全文
Apr252012
php取得汉字的首字母
>?php
/**
* @param unknown_type $str
* @return 取得汉字的首字母
*/
function getfirstchar($str){
$fchar=$str[0];
//判断是否为字符串
if(ord($fchar)-->=ord("A") && ord($fchar)=-20319 and $asc=-20283 and $asc=-19775 and $asc=-19218 and $asc=-18710 and $asc=-18526 and $asc=-18239 and $asc=-17922 and $asc=-17417 and $asc=-16474 and $asc=-16212 an...阅读全文
Apr232012
httpd.ini转.htaccess 重写教程
使用ISAPI Rewrite与Apache Rewrite是有区别的,主要是URL重写规则细节上,ISAPI[一般是windows系统]重写需要使用httpd.ini文件,而Apache[一般是unix系统]则使用.htaccess文件,通过对URL重写实例谈谈使用httpd.ini文件基于ISAPI Rewrite重写URL路径。目前使用的是wordpress程序,虽然前台已经全部重新架构,但URL路径还是使用原有简单的URL,如一篇文章的URL路径:http://www.90qb.com/?p...阅读全文
Apr232012
发布个查询手机归属地的API
查询手机归属地的API
<?php
//调用方式域名后加上 ?mobile=13006764649
function Mobile_Ownership($Mobile) {
if (! empty ( $Mobile )) {
$Url = 'http://www.ip138.com:8080/search.asp?mobile=' . $Mobile . '&action=mobile';
$Result = file_get_contents ( $Url );
$start_str = strpos ( $Result, '<TABLE width=349 border="1"' );
$end_str = strrpos ( ...阅读全文
Apr222012