年度归档:2014年

图片下方出现缝隙解决方法

今天在做一个手机网页时,发现一个奇怪的问题,代码没问题,可是预览时总是发现图片下方和div边框之间有一条4px的空隙,最后还是得以解决。

最简单的办法是固定高度:

<div style="width: 900px;height: 75px;margin-top: 0px;"><img src="images/top.jpg" width="900" height="75"></div>

一个可以使用display属性解决:

<div style="float: left;"> <img src="images/picture1.jpg" style="border:4px solid #191919;display:block;" width="553" height="179" /> </div>

另一个可以用vertical-align属性解决:

<div style="float: left;"> <img id="pic1" src="images/picture1.jpg" style="border:4px solid #191919;vertical-align:top;" width="553" height="179" /> </div> 

使用margin-bottom属性解决:

<div style="width: 900px;height: 75px;margin-top: 0px;"> <img src="images/top.jpg" style="margin-bottom: -4px;"  width="900" height="75"> </div>

使用字体大小属性font-size解决:

<div style="width: 900px;height: 75px;margin-top: 0px;font-size:0"> <img src="images/top.jpg" width="900" height="75"> </div>

我几种方法都试了下,发现在手机上有时还会有一点点缝隙,最后 我使用margin-bottom:-5px;多剪去1px,这样就完美显示了

margin-bottom: -5px;

CSS解决图片下面有空隙的简单方法

在用CSS制作网页过程中可能会碰到图片下面有空隙的问题,本文给出了最为简单的解决方法。

解决方法:在图片的css中加 vertical-align:bottom; 效果

例如:

0

演示代码:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>解决图片下有空隙</title>
</head>
<body>
<style>
*{margin:0px;padding:0px;}
#l1 {float:left;background:#000;padding:20px;margin:50px;}
#l1 ul li {list-style:none;}
#l1 ul li img {vertical-align:bottom; display:block;}
</style>
<div id="l1">
   <ul>
    <li><img src="图片地址1" /></li>
    <li><img src="图片地址2" /></li>
    <li><img src="图片地址3" /></li>
    <li><img src="图片地址4" /></li>
   </ul>
</div>
</body>
</html>

PHP利用showmycode在线解密Zend加密的文件

PHP利用showmycode在线解密Zend加密的文件

 

 /**
     * 在线解密Zend加密
     * @author jakehu
     * @date   2014-06-10
     */
header("Content-Type: text/html; charset=utf-8");
if (@$_REQUEST['action']=='bomp') {
    if ($_FILES["file"]){      
        move_uploaded_file($_FILES["file"]["tmp_name"],"temp/" . $_FILES["file"]["name"]);
        $path = "temp/" . $_FILES["file"]["name"];
    }
 
    $decodingurl = $_REQUEST['decodingurl'];
    $captcha = $_REQUEST['captcha'];
    $cookies = $_REQUEST['cookies'];
    $query['MAX_FILE_SIZE'] = 2097152;
    $query['decodingurl'] = $decodingurl;
    $query['upload'] = '@'.dirname(__FILE__).'/'.$path;
    $query['captcha'] = $captcha;
    
    $url = 'http://www.showmycode.com/';
    $ch = curl_init ();
    curl_setopt ( $ch, CURLOPT_URL, $url );
    curl_setopt ( $ch, CURLOPT_HEADER, 0 );
    curl_setopt ( $ch, CURLOPT_RETURNTRANSFER, 1 );
    curl_setopt(  $ch, CURLOPT_REFERER, "http://www.showmycode.com");
    curl_setopt ( $ch, CURLOPT_POST, 1 );
    curl_setopt ( $ch, CURLOPT_POSTFIELDS, $query );
    curl_setopt ( $ch, CURLOPT_COOKIE, $cookies );
    $result = curl_exec ( $ch ); // 
    curl_close ( $ch );
    
    $result = explode('', $result);
    $result = explode('', $result[1]);   
    
    echo $result[0].', Here is the result:';
      
    $url = 'http://www.showmycode.com/?download';
    $ch = curl_init ();
    curl_setopt ( $ch, CURLOPT_URL, $url );
    curl_setopt ( $ch, CURLOPT_HEADER, 0 );
    curl_setopt ( $ch, CURLOPT_RETURNTRANSFER, 1 );
    curl_setopt(  $ch, CURLOPT_REFERER, "http://www.showmycode.com");
    curl_setopt ( $ch, CURLOPT_COOKIE, $cookies );
    $result = curl_exec ( $ch ); //
    curl_close ( $ch );
 
    echo "";
    //因博客代码高亮问题注释显示(使用时请打开上面注释)
    exit();
}
$url = "http://www.showmycode.com/?c";
$ch = curl_init ();
curl_setopt ( $ch, CURLOPT_URL, $url );
curl_setopt ( $ch, CURLOPT_HEADER, 1 );
curl_setopt ( $ch, CURLOPT_RETURNTRANSFER, 1 );
curl_setopt(  $ch, CURLOPT_REFERER, "http://www.showmycode.com");
curl_setopt ( $ch, CURLOPT_POST, 0 );
$result = curl_exec ( $ch ); // 
curl_close ( $ch );
 
list ( $header1, $body ) = explode ( "rnrn", $result );
preg_match_all ( '/set-cookie:([^;]*)/i', $header1, $matches );
echo "";
//因博客代码高亮问题注释显示(使用时请打开上面注释)
$cookies = trim($matches[1][1]);
echo "";
echo "action:";
echo "cookies:";
echo "file:";
echo "decodingurl:";
echo "captcha:";
echo "";
echo "";
echo "";

利用PHP获取Google PR值代码片段

用php的方法取谷歌的PR值。事实上我已经很久没关注PR值了,PR值 也不像以前那样备受关注,影响力有所下降。

function pagerank($domain)
{
$StartURL = "http://toolbarqueries.google.com/tbr?client=navclient-auto&features=Rank&q=info:";
$GoogleURL = $StartURL.$domain. '&ch='.HashURL($domain);
$fcontents = file_get_contents("$GoogleURL");
$pagerank = substr($fcontents,9);
if (!$pagerank) return "0";else return $pagerank;
}
 
function HashURL($url)
{
$SEED = "Mining PageRank is AGAINST GOOGLE’S TERMS OF SERVICE.";
$Result = 0x01020345;
for ($i=0; $i<strlen($url); $i++) { $Result ^= ord($SEED{$i%87}) ^ ord($url{$i}); $Result = (($Result >> 23) & 0x1FF) | $Result << 9;
}
return sprintf("8%x", $Result);
}
 
echo pagerank("saycn.net");

如果是64位的系统,上面的代码运行不了,HashURL的函数换为下面的。

function HashURL($url)
{
$SEED = "Mining PageRank is AGAINST GOOGLE’S TERMS OF SERVICE.";
$Result = 0x01020345;
for ($i=0; $i<strlen($url); $i++) { $Result ^= ord($SEED{$i%87}) ^ ord($url{$i}); $Result = (($Result >> 23) & 0x1FF) | $Result << 9 & 0xFFFFFFFF;
}
return sprintf("8%x", $Result);
}

如何使用Php实现Google /Baidu Ping服务快速收录

玩过WORDPRESS的朋友应该都知道ping服务吧,通俗点讲它可以在更新文章的时候向Google、baidu及其他支持ping的搜索引擎发送指令然后招呼它们过来,不用傻等他们过来收录了,化被动为主动了。直接贴代码了,很简单的。

/**
  +------------------------------------------------------------------------------
 * 通知搜索引擎过来抓去最新发布的内容。秒收不是梦
 * 目前仅支持Google和Baidu
  +------------------------------------------------------------------------------
 */
class Ping {
 
    public $method, $callback;
 
    public function method($site_name, $site_url, $update_url, $update_rss) {
        $this->method = '
    < ?xml version="1.0" encoding="UTF-8"?>
    
      weblogUpdates.extendedPing
      
     {$site_name}
     {$site_url}
     {$update_url}
     {$update_rss}
      
    ';
        return $this->method;
    }
 
    public function _post($url, $postvar) {
        $ch = curl_init();
        $headers = array(
            "POST " . $url . " HTTP/1.0",
            'Content-type: text/xml;charset="utf-8"',
            "Accept: text/xml",
            "Content-length: " . strlen($postvar)
        );
        curl_setopt($ch, CURLOPT_URL, $url);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
        curl_setopt($ch, CURLOPT_POST, 1);
        curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
        curl_setopt($ch, CURLOPT_POSTFIELDS, $postvar);
        $res = curl_exec($ch);
        curl_close($ch);
        return $res;
    }
 
    public function google() {
        $this->callback = $this->_post('http://blogsearch.google.com/ping/RPC2', $this->method);
        return strpos($this->callback, "0") ? true : false;
    }
 
    public function baidu() {
        $this->callback = $this->_post('http://ping.baidu.com/ping/RPC2', $this->method);
        return strpos($this->callback, "0") ? true : false;
    }
     
}


下面演示一下如何调用

$Ping=new Ping();
$Ping->method('xxx博客', 'http://saycn.net/', 'http://saycn.net/xxx', 'http://saycn.net/feed');
$Ping->baidu();
$Ping->google();