<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>BTHOME</title>
	<atom:link href="http://www.bthome.com.cn/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.bthome.com.cn</link>
	<description>网站开发设计,drupal,wordpress,seo建站经验分享</description>
	<lastBuildDate>Tue, 25 Jan 2011 05:03:03 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.4</generator>
		<item>
		<title>WordPress 去掉评论中链接的方法</title>
		<link>http://www.bthome.com.cn/2011/01/25/wordpress-%e5%8e%bb%e6%8e%89%e8%af%84%e8%ae%ba%e4%b8%ad%e9%93%be%e6%8e%a5%e7%9a%84%e6%96%b9%e6%b3%95/</link>
		<comments>http://www.bthome.com.cn/2011/01/25/wordpress-%e5%8e%bb%e6%8e%89%e8%af%84%e8%ae%ba%e4%b8%ad%e9%93%be%e6%8e%a5%e7%9a%84%e6%96%b9%e6%b3%95/#comments</comments>
		<pubDate>Tue, 25 Jan 2011 05:03:03 +0000</pubDate>
		<dc:creator>administrator</dc:creator>
				<category><![CDATA[wordpress]]></category>
		<category><![CDATA[评论]]></category>
		<category><![CDATA[链接]]></category>

		<guid isPermaLink="false">http://www.bthome.com.cn/?p=102</guid>
		<description><![CDATA[俗话说道高一尺，魔高一丈，既然做了一名 WordPress 独立博客的博主，就要有与垃圾评论斗争到底的信心与决心，但是作为一名打不走，骂不离，死皮赖脸的 Spammer，就要做好与各位博主们周旋的准备。我见的最多的垃圾评论就是在留言中 Ctrl+C、Ctrl+V 千篇一律的话，什么“过来踩踩”、“博主加油”，然后撒下一坨链接就闪人了。这是最没有职业素养的 Spammer（……此处省略三千字对垃圾评论的无限鄙视……） 要防止垃圾评论对 WordPress 本身权重的影响，Wordpress 本身的 nofollow 标签肯定是不够的，所以我还用了 WordPress 评论链接重定向跳转，如果你觉得这还不够彻底的话，可以用这个方法，索性把 WordPress 评论中包括链接的 a 标签过滤掉，只剩下一个无法点击的链接文本。 方法和过滤并替换 WordPress 留言指定字符是差不多的，也是用的钩子，外加一个 PHP 的正则表达式，把链接过滤出来，把以下代码复制到 WordPress 主题文件夹的 functions.php 中就可以了： add_filter(&#8216;comment_text&#8217;, &#8217;no_url_text&#8217;, 10); function no_url_text($text = &#8221;){ $text = preg_replace(&#8220;/&#60;a[^&#62;]*href=[^&#62;]*&#62;&#124;&#60;\/[^a]*a[^&#62;]*&#62;/i&#8221;,&#8221;",$text); echo $text; } 童鞋们不用在我这里测试了，因为我没有用上，这里是纯解说，无实践。 另外，如果你觉得这还不够彻底，那还有一个更绝的！就是把所有评论者的链接都去掉，不过这样的话在干掉 Spammer 的同时也会干掉所有无辜的博友，请慎用啊。去掉 WordPress 评论者的链接，看到很多参考方法都说改 WordPress 的源文件，其实我不建议那么干，一方面这个方法太原始，咱要玩高级的；另一方面，以后 WordPress 升级就会覆盖掉，所以我们还是在主题文件的 functions.php 中添加钩子比较好： add_filter(&#8216;get_comment_author_link&#8217;, &#8217;no_url_author&#8217;, 20); function no_url_author($text = &#8221;){ $text = preg_replace(&#8220;/&#60;a[^&#62;]*href=[^&#62;]*&#62;&#124;&#60;\/[^a]*a[^&#62;]*&#62;/i&#8221;,&#8221;",$text); echo $text; } 这下世界就清静了，不过做的太狠，你的博客也会很清静哟，三思而行吧。]]></description>
			<content:encoded><![CDATA[<p>俗话说道高一尺，魔高一丈，既然做了一名 WordPress 独立博客的博主，就要有与垃圾评论斗争到底的信心与决心，但是作为一名打不走，骂不离，死皮赖脸的 Spammer，就要做好与各位博主们周旋的准备。我见的最多的垃圾评论就是在留言中 Ctrl+C、Ctrl+V 千篇一律的话，什么“过来踩踩”、“博主加油”，然后撒下一坨链接就闪人了。这是最没有职业素养的 Spammer（……此处省略三千字对垃圾评论的无限鄙视……）</p>
<p>要防止垃圾评论对 WordPress 本身权重的影响，Wordpress 本身的 nofollow 标签肯定是不够的，所以我还用了 <a title="Wordpress 评论链接重定向跳转" href="http://wange.im/comments-link-redirect-for-wordpress.html">WordPress 评论链接重定向跳转</a>，如果你觉得这还不够彻底的话，可以用这个方法，索性把 WordPress 评论中包括链接的 a 标签过滤掉，只剩下一个无法点击的链接文本。</p>
<p>方法和<a title="过滤并替换 WordPress 留言指定字符" href="http://wange.im/replace-comment-text-in-wordpress.html">过滤并替换 WordPress 留言指定字符</a>是差不多的，也是用的钩子，外加一个 PHP 的正则表达式，把链接过滤出来，把以下代码复制到 WordPress 主题文件夹的 functions.php 中就可以了：</p>
<p>add_filter(&#8216;comment_text&#8217;, &#8217;no_url_text&#8217;, 10);<br />
function no_url_text($text = &#8221;){<br />
$text = preg_replace(&#8220;/&lt;a[^&gt;]*href=[^&gt;]*&gt;|&lt;\/[^a]*a[^&gt;]*&gt;/i&#8221;,&#8221;",$text);<br />
echo $text;<br />
}</p>
<p>童鞋们不用在我这里测试了，因为我没有用上，这里是纯解说，无实践。</p>
<p>另外，如果你觉得这还不够彻底，那还有一个更绝的！就是把所有评论者的链接都去掉，不过这样的话在干掉 Spammer 的同时也会干掉所有无辜的博友，请慎用啊。去掉 WordPress 评论者的链接，看到很多参考方法都说改 WordPress 的源文件，其实我不建议那么干，一方面这个方法太原始，咱要玩高级的；另一方面，以后 WordPress 升级就会覆盖掉，所以我们还是在主题文件的 functions.php 中添加钩子比较好：</p>
<p>add_filter(&#8216;get_comment_author_link&#8217;, &#8217;no_url_author&#8217;, 20);<br />
function no_url_author($text = &#8221;){<br />
$text = preg_replace(&#8220;/&lt;a[^&gt;]*href=[^&gt;]*&gt;|&lt;\/[^a]*a[^&gt;]*&gt;/i&#8221;,&#8221;",$text);<br />
echo $text;<br />
}</p>
<p>这下世界就清静了，不过做的太狠，你的博客也会很清静哟，三思而行吧。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.bthome.com.cn/2011/01/25/wordpress-%e5%8e%bb%e6%8e%89%e8%af%84%e8%ae%ba%e4%b8%ad%e9%93%be%e6%8e%a5%e7%9a%84%e6%96%b9%e6%b3%95/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>split &#8212; 用正则表达式将字符串分割到数组中</title>
		<link>http://www.bthome.com.cn/2010/12/22/split-%e7%94%a8%e6%ad%a3%e5%88%99%e8%a1%a8%e8%be%be%e5%bc%8f%e5%b0%86%e5%ad%97%e7%ac%a6%e4%b8%b2%e5%88%86%e5%89%b2%e5%88%b0%e6%95%b0%e7%bb%84%e4%b8%ad/</link>
		<comments>http://www.bthome.com.cn/2010/12/22/split-%e7%94%a8%e6%ad%a3%e5%88%99%e8%a1%a8%e8%be%be%e5%bc%8f%e5%b0%86%e5%ad%97%e7%ac%a6%e4%b8%b2%e5%88%86%e5%89%b2%e5%88%b0%e6%95%b0%e7%bb%84%e4%b8%ad/#comments</comments>
		<pubDate>Wed, 22 Dec 2010 08:23:45 +0000</pubDate>
		<dc:creator>administrator</dc:creator>
				<category><![CDATA[php]]></category>
		<category><![CDATA[split]]></category>
		<category><![CDATA[数组]]></category>
		<category><![CDATA[正则表达式]]></category>

		<guid isPermaLink="false">http://www.bthome.com.cn/?p=96</guid>
		<description><![CDATA[split (PHP 3, PHP 4, PHP 5) split &#8212; 用正则表达式将字符串分割到数组中 说明 array split ( string pattern, string string [, int limit] ) 提示: preg_split() 函数使用了 Perl 兼容正则表达式语法，通常是比 split() 更快的替代方案。如果不需要正则表达式的威力，则使用 explode() 更快，这样就不会招致正则表达式引擎的浪费。 本函数返回一个字符串数组，每个单元为 string 经区分大小写的正则表达式 pattern 作为边界分割出的子串。如果设定了 limit，则返回的数组最多包含 limit 个单元，而其中最后一个单元包含了 string 中剩余的所有部分。如果出错，则 split() 返回 FALSE。 将 /etc/passwd 中的前四个字段分割出来： 例子 1. split() 例子 如果字符串中有 n 个与 pattern [...]]]></description>
			<content:encoded><![CDATA[<p>split</p>
<p>(PHP 3, PHP 4, PHP 5)<br />
split &#8212; 用正则表达式将字符串分割到数组中</p>
<p>说明</p>
<p>array split ( string pattern, string string [, int limit] )</p>
<p>提示:</p>
<p>preg_split() 函数使用了</p>
<p>Perl 兼容正则表达式语法，通常是比</p>
<p>split() 更快的替代方案。如果不需要正则表达式的威力，则使用</p>
<p>explode() 更快，这样就不会招致正则表达式引擎的浪费。</p>
<p>本函数返回一个字符串数组，每个单元为</p>
<p>string 经区分大小写的正则表达式</p>
<p>pattern 作为边界分割出的子串。如果设定了</p>
<p>limit，则返回的数组最多包含</p>
<p>limit 个单元，而其中最后一个单元包含了</p>
<p>string 中剩余的所有部分。如果出错，则</p>
<p>split() 返回 FALSE。</p>
<p>将 /etc/passwd 中的前四个字段分割出来：</p>
<p>例子 1. split() 例子</p>
<p><!--?php list($user, $pass, $uid, $gid, $extra) = split (":", $passwd_line, 5); ?--></p>
<p>如果字符串中有 n 个与</p>
<p>pattern 匹配的项目，则返回的数组将包含</p>
<p>n+1 个单元。例如，如果没有找到</p>
<p>pattern，则会返回一个只有一个单元的数组。当然，如果</p>
<p>string 为空也是这样。</p>
<p>解析可能用斜线，点，或横线分割的日期：</p>
<p>例子 2. split() 例子</p>
<p><!--?php</p-->
<p>// 分隔符可以是斜线，点，或横线</p>
<p>$date = &#8220;04/30/1973&#8243;;</p>
<p>list($month, $day, $year) = split (&#8216;[/.-]&#8216;, $date);</p>
<p>echo &#8220;Month: $month; Day: $day; Year: $year<br />
\n&#8221;;</p>
<p>?&gt;</p>
<p>想仿效 Perl 中类似的 @chars =</p>
<p>split(&#8221;, $str) 行为，请参考</p>
<p>preg_split() 函数中的例子。</p>
<p>注意 pattern</p>
<p>是一个正则表达式。如果想要用的分割字符是正则表达式中的特殊字符，要先将其转义。如果觉得</p>
<p>split()（或其它任何 regex 函数）行为古怪的话，请阅读包含在</p>
<p>PHP 发行包中 regex/ 子目录下的</p>
<p>regex.7 文件。该文件是手册页面格式，可以用类似</p>
<p>man /usr/local/src/regex/regex.7 的命令来阅读。</p>
<p>参见 preg_split()，spliti()，explode()，implode()，chunk_split()</p>
<p>和 wordwrap()。</p>
<p>add a note</p>
<p>User Contributed Notes</p>
<p>split</p>
<p>dan dot jones at lunarfish dot co dot uk</p>
<p>17-Aug-2006 08:24</p>
<p>Here&#8217;s a function to split a string into csv values where they are optionally enclosed by &#8221; to allow values with commas in.</p>
<p>I think it works. Let me know if I&#8217;m wrong.</p>
<p>Cheers. Dan</p>
<p>function getCSVValues($string) {</p>
<p>// split the string at double quotes &#8221;</p>
<p>$bits = split(&#8216;&#8221;&#8216;,$string);</p>
<p>$elements = array();</p>
<p>for ($i=0;$i</p>
<p>/*</p>
<p>odd numbered elements would have been</p>
<p>enclosed by double quotes</p>
<p>even numbered elements would not have been</p>
<p>*/</p>
<p>if (($i%2) == 1) {</p>
<p>/* if the element number is odd add the</p>
<p>whole string  to the output array */</p>
<p>$elements[] = $bits[$i];</p>
<p>} else {</p>
<p>/* otherwise split the unquoted stuff at commas</p>
<p>and add the elements to the array */</p>
<p>$rest = $bits[$i];</p>
<p>$rest = preg_replace(&#8220;/^,/&#8221;,&#8221;",$rest);</p>
<p>$rest = preg_replace(&#8220;/,$/&#8221;,&#8221;",$rest);</p>
<p>$elements = array_merge($elements,split(&#8216;,&#8217;,$rest));</p>
<p>}</p>
<p>}</p>
<p>return $elements;</p>
<p>}</p>
<p>destes at ix dot netcom dot com</p>
<p>14-Feb-2006 04:15</p>
<p>Some corrections to robin-at-teddyb&#8217;s CSV splitting function.  Recall</p>
<p>that the point of this is to properly implement a split() function that</p>
<p>handles data exported to CSV, where data containing commas gets</p>
<p>quote-delimited.<br />
* Problem 1: As jh-at-junetz pointed out, the +1 in robin&#8217;s</p>
<p>nonquoted splitting command mistakenly adds an extra element to the</p>
<p>resulting array.<br />
* Problem 2: If consecutive fields are quote-delimited, the</p>
<p>remaining &#8220;separator&#8221; between them only contains one delimiter and no</p>
<p>actual fields &#8211; so an extra element gets added to the parsed array.<br />
* Problem 3: When double-quotes appear in a spreadsheet exported</p>
<p>to CSV, they get escaped by doubling them, i.e. a data field reading</p>
<p>&#8220;this is a test of a &#8220;special&#8221; case&#8221; gets written to CSV as, &#8220;this is a</p>
<p>test of a &#8220;&#8221;special&#8221;" case&#8221;.  These quotes are also interpreted as</p>
<p>top-level delimiters and (mistakenly) add extra array elements to the</p>
<p>output.</p>
<p>I have hacked a conversion of &#8220;&#8221; to a single quote ( &#8216; ), but a truly</p>
<p>clever preg_split for the top-level splitter (instead of the explode)</p>
<p>might preserve the original doubled &#8220;s without bugging up the top-level</p>
<p>parsing.  i.e., a smarter man than I could solve the problem rather</p>
<p>than avoiding it by replacing the bad data.</p>
<p>(current) Solution:</p>
<p><!--?php function quotesplit( $splitter=',', $s, $restore_quotes=0 ) { // hack because i'm a bad programmer - replace doubled "s with a ' $s = str_replace('""', "'", $s); //First step is to split it up into the bits that are surrounded by quotes //and the bits that aren't. Adding the delimiter to the ends simplifies //the logic further down $getstrings = explode('"', $splitter.$s.$splitter); //$instring toggles so we know if we are in a quoted string or not $delimlen = strlen($splitter); $instring = 0; while (list($arg, $val) = each($getstrings)) { if ($instring==1) { if( $restore_quotes ) { //Add the whole string, untouched to the previous value in the array $result[count($result)-1] = $result[count($result)-1].'"'.$val.'"'; } else { //Add the whole string, untouched to the array $result[] = $val; } $instring = 0; } else { // check that we have data between multiple $splitter delimiters if ((strlen($val)-$delimlen) -->= 1) {</p>
<p>//Break up the string according to the delimiter character</p>
<p>//Each string has extraneous delimiters around it (inc the ones we added</p>
<p>//above), so they need to be stripped off</p>
<p>$temparray = split($splitter, substr($val, $delimlen, strlen($val)-$delimlen-$delimlen ) );</p>
<p>while(list($iarg, $ival) = each($temparray)) {</p>
<p>$result[] = trim($ival);</p>
<p>}</p>
<p>}</p>
<p>// else, the next element needing parsing is a quoted string and the comma</p>
<p>// here is just a single separator and contains no data, so skip it</p>
<p>$instring = 1;</p>
<p>}</p>
<p>}</p>
<p>return $result;</p>
<p>}</p>
<p>?&gt;</p>
<p>RE: gcerretini at technica dot net /UTF8</p>
<p>08-Feb-2006 08:26</p>
<p>Original problem:</p>
<p>=================</p>
<p>I&#8217;ve try using split function.</p>
<p><!--?php</p-->
<p>$ferro=&#8221;2�12&#8243;;</p>
<p>$valore=split(&#8220;[�]&#8220;,$ferro);</p>
<p>echo $ferro.&#8221;<br />
&#8220;;</p>
<p>echo &#8220;p1-&#8221;.$valore[0].&#8221;<br />
&#8220;;</p>
<p>echo &#8220;p2-&#8221;.$valore[1].&#8221;<br />
&#8220;;</p>
<p>echo &#8220;p3-&#8221;.$valore[2].&#8221;<br />
&#8220;;</p>
<p>$ferro=&#8221;2d12&#8243;;</p>
<p>$valore=split(&#8220;[d]&#8220;,$ferro);</p>
<p>echo $ferro.&#8221;<br />
&#8220;;</p>
<p>echo &#8220;p1-&#8221;.$valore[0].&#8221;<br />
&#8220;;</p>
<p>echo &#8220;p2-&#8221;.$valore[1].&#8221;<br />
&#8220;;</p>
<p>echo &#8220;p3-&#8221;.$valore[2].&#8221;<br />
&#8220;;</p>
<p>?&gt;</p>
<p>This return:</p>
<p>============</p>
<p>2�12</p>
<p>p1-2</p>
<p>p2-</p>
<p>p3-12</p>
<p>2d12</p>
<p>p1-2</p>
<p>p2-12</p>
<p>p3-</p>
<p>I use charset UTF-8. When I use char � the split function ad an empty string between &#8220;2&#8243; and &#8220;12&#8243;&#8230; Why?</p>
<p>Explanation:</p>
<p>============<br />
UTF-8 charset codes some characters (like the &#8220;�&#8221;</p>
<p>character) into two bytes. In fact the regular expresion</p>
<p>&#8220;[�]&#8221; contains 4 bytes (4 non-unicode characters). To</p>
<p>demonstrate the real situation I wrote following example:</p>
<p>$ferro=&#8221;2de12&#8243;;</p>
<p>$valore=split(&#8220;[de]&#8220;,$ferro);</p>
<p>echo $ferro.&#8221;<br />
&#8220;;</p>
<p>echo &#8220;p1-&#8221;.$valore[0].&#8221;<br />
&#8220;;</p>
<p>echo &#8220;p2-&#8221;.$valore[1].&#8221;<br />
&#8220;;</p>
<p>echo &#8220;p3-&#8221;.$valore[2].&#8221;<br />
&#8220;;</p>
<p>This returns:</p>
<p>=============</p>
<p>2d12</p>
<p>p1-2</p>
<p>p2-</p>
<p>p3-12</p>
<p>gcerretini at technica dot net</p>
<p>28-Jan-2006 02:46</p>
<p>I&#8217;ve try using split function.</p>
<p><!--?PHP</p-->
<p>$ferro=&#8221;2?12&#8243;;</p>
<p>$valore=split(&#8220;[?]&#8220;,$ferro);</p>
<p>echo $ferro.&#8221;<br />
&#8220;;</p>
<p>echo &#8220;p1-&#8221;.$valore[0].&#8221;<br />
&#8220;;</p>
<p>echo &#8220;p2-&#8221;.$valore[1].&#8221;<br />
&#8220;;</p>
<p>echo &#8220;p3-&#8221;.$valore[2].&#8221;<br />
&#8220;;</p>
<p>$ferro=&#8221;2d12&#8243;;</p>
<p>$valore=split(&#8220;[d]&#8220;,$ferro);</p>
<p>echo $ferro.&#8221;<br />
&#8220;;</p>
<p>echo &#8220;p1-&#8221;.$valore[0].&#8221;<br />
&#8220;;</p>
<p>echo &#8220;p2-&#8221;.$valore[1].&#8221;<br />
&#8220;;</p>
<p>echo &#8220;p3-&#8221;.$valore[2].&#8221;<br />
&#8220;;</p>
<p>?&gt;</p>
<p>This return:</p>
<p>2?12</p>
<p>p1-2</p>
<p>p2-</p>
<p>p3-12</p>
<p>2d12</p>
<p>p1-2</p>
<p>p2-12</p>
<p>p3-</p>
<p>I use charset UTF-8</p>
<p>When I use char ? the split function ad an empty string between &#8220;2&#8243; and &#8220;12&#8243; Why?</p>
<p>shimon at schoolportal dot co dot il</p>
<p>27-Dec-2005 04:34</p>
<p><!--?</p-->
<p>// **</p>
<p>// * splitslash()</p>
<p>// *</p>
<p>// * this function enables to split with an escape char;</p>
<p>// *</p>
<p>// * @since 25/12/05 21:26:00</p>
<p>// * @author Shimon Doodkin</p>
<p>// *</p>
<p>// * @param $string</p>
<p>// * @param $string</p>
<p>// * @return Array()</p>
<p>// **</p>
<p>function splitslash($split,$str,$esc=&#8217;\\\\&#8217;)</p>
<p>{</p>
<p>$o=explode($split,$str);</p>
<p>$oc=count($o);</p>
<p>$a=array();</p>
<p>for($i=0;$i&lt;$oc;$i++)</p>
<p>{</p>
<p>$o2=explode($esc.$esc,$o[$i]);</p>
<p>$o2c=count($o2);</p>
<p>if($o2[$o2c-1][strlen($o2[$o2c-1])-1]==$esc)</p>
<p>{</p>
<p>$o2[$o2c-1]=substr($o2[$o2c-1],0,-1);</p>
<p>if($i+1&lt;$oc) { $o[$i+1]=join($esc.$esc,$o2).$split.$o[$i+1]; } else { //echo &#8220;error&#8221;; $a[]=join($esc,$o2); //do like ok } } else { $a[]=join($esc,$o2); } } return $a; } // example: $r=splitslash(&#8220;NA&#8221;,&#8221;mooNAmooNAma\\\\ma\\NA&#8221;); print_r($r); //output: /* Array ( [0] =&gt; moo</p>
<p>[1] =&gt; moo</p>
<p>[2] =&gt; ma\\maNA</p>
<p>)</p>
<p>*/</p>
<p>?&gt;</p>
<p>04-Dec-2005 09:57</p>
<p>Be advised</p>
<p>$arr = split(&#8220;x&#8221;, &#8220;x&#8221; );</p>
<p>print_r($arr);</p>
<p>will output:</p>
<p>Array</p>
<p>(</p>
<p>[0] =&gt;</p>
<p>[1] =&gt;</p>
<p>)</p>
<p>That is it will catch 2 empty strings on each side of the delimiter.</p>
<p>franz at fholzinger dot com</p>
<p>04-Nov-2005 08:34</p>
<p>The example from ramkumar rajendran did not work.</p>
<p>$line = split(&#8220;/\n&#8221;, $input_several_lines_long);</p>
<p>I do not know why this does not work for me.</p>
<p>The following has worked for me to get a maximum of 2 array parts</p>
<p>separated by the first new line (independant if saved under UNIX or</p>
<p>WINDOWS):</p>
<p>$line = preg_split(&#8216;/[\n\r]+/&#8217;,$input_several_lines_long,2);</p>
<p>Also empty lines are not considered here.</p>
<p>passtschu AT freenet DOT de</p>
<p>24-Sep-2005 03:09</p>
<p>divide a string with a template. the &#8220;template dividers&#8221; are the keys for the output array.</p>
<p><!--?PHP function string2array ($string, $template){ #search defined dividers preg_match_all ("|%(.+)%|U", $template, $template_matches); #replace dividers with "real dividers" $template = preg_replace ("|%(.+)%|U", "(.+)", $template); #search matches preg_match ("|" . $template . "|", $string, $string_matches); #[template_match] =--> $string_match</p>
<p>foreach ($template_matches[1] as $key =&gt; $value){</p>
<p>$output[$value] = $string_matches[($key + 1)];</p>
<p>}</p>
<p>return $output;</p>
<p>}</p>
<p>$string1 = &#8216;www.something.com 66.196.91.121 &#8211; - [01/Sep/2005:04:20:39 +0200] &#8220;GET /robots.txt HTTP/1.0&#8243; 200 49 &#8220;-&#8221;&#8216;;</p>
<p>$string2= &#8216;%Domain% %IP% &#8211; %User% \[%Date%:%Time% %TimeZone%\] &#8220;%Method% %Request% %Protocol%&#8221; %ServerCode% %Bytes% &#8220;%Referer%&#8221;&#8216;;</p>
<p>print_r (string2array ($string1, $string2));</p>
<p>/*</p>
<p>Array</p>
<p>(</p>
<p>[ServerAddress] =&gt; www.something.com</p>
<p>[IP] =&gt; 66.196.91.121</p>
<p>[User] =&gt; -</p>
<p>[Date] =&gt; 01/Sep/2005</p>
<p>[Time] =&gt; 04:20:39</p>
<p>[TimeZone] =&gt; +0200</p>
<p>[Method] =&gt; GET</p>
<p>[Request] =&gt; /robots.txt</p>
<p>[Protocol] =&gt; HTTP/1.0</p>
<p>[ServerCode] =&gt; 200</p>
<p>[Bytes] =&gt; 49</p>
<p>[Referer] =&gt; -</p>
<p>)</p>
<p>*/</p>
<p>?&gt;</p>
<p>jh at junetz dot de</p>
<p>04-Jul-2005 12:34</p>
<p>robin: Nice function, saved my day. The +1 at the end of split / substr is wrong, though.</p>
<p>robin at teddyb dot org</p>
<p>30-Jun-2005 12:01</p>
<p>Actually, this version is better than the last I submitted.  The goal</p>
<p>here is to be able to engage in *multiple* delimeter removal passes;</p>
<p>for all but the last pass, set the third value to &#8220;1&#8243;, and everything</p>
<p>should go well.</p>
<p>function quotesplit( $splitter=&#8217;,', $s, $restore_quotes=0 )</p>
<p>{</p>
<p>//First step is to split it up into the bits that are surrounded by quotes</p>
<p>//and the bits that aren&#8217;t. Adding the delimiter to the ends simplifies</p>
<p>//the logic further down</p>
<p>$getstrings = explode(&#8216;&#8221;&#8216;, $splitter.$s.$splitter);</p>
<p>//$instring toggles so we know if we are in a quoted string or not</p>
<p>$delimlen = strlen($splitter);</p>
<p>$instring = 0;</p>
<p>while (list($arg, $val) = each($getstrings))</p>
<p>{</p>
<p>if ($instring==1)</p>
<p>{</p>
<p>if( $restore_quotes )</p>
<p>{</p>
<p>//Add the whole string, untouched to the previous value in the array</p>
<p>$result[count($result)-1] = $result[count($result)-1].&#8217;&#8221;&#8216;.$val.&#8217;&#8221;&#8216;;</p>
<p>} else {</p>
<p>//Add the whole string, untouched to the array</p>
<p>$result[] = $val;</p>
<p>}</p>
<p>$instring = 0;</p>
<p>}</p>
<p>else</p>
<p>{</p>
<p>//Break up the string according to the delimiter character</p>
<p>//Each string has extraneous delimiters around it (inc the ones we added</p>
<p>//above), so they need to be stripped off</p>
<p>$temparray = split($splitter, substr($val, $delimlen, strlen($val)-$delimlen-$delimlen+1 ) );</p>
<p>while(list($iarg, $ival) = each($temparray))</p>
<p>{</p>
<p>$result[] = trim($ival);</p>
<p>}</p>
<p>$instring = 1;</p>
<p>}</p>
<p>}</p>
<p>return $result;</p>
<p>}</p>
<p>robin at teddyb dot org</p>
<p>30-Jun-2005 11:50</p>
<p>wchris&#8217;s quotesplit assumes that anything that is quoted must also be a</p>
<p>complete delimiter-seperated entry by itself.  This version does not.</p>
<p>It also uses split&#8217;s argument order.</p>
<p>function quotesplit( $splitter=&#8217;,', $s )</p>
<p>{</p>
<p>//First step is to split it up into the bits that are surrounded by quotes</p>
<p>//and the bits that aren&#8217;t. Adding the delimiter to the ends simplifies</p>
<p>//the logic further down</p>
<p>$getstrings = explode(&#8216;&#8221;&#8216;, $splitter.$s.$splitter);</p>
<p>//$instring toggles so we know if we are in a quoted string or not</p>
<p>$delimlen = strlen($splitter);</p>
<p>$instring = 0;</p>
<p>while (list($arg, $val) = each($getstrings))</p>
<p>{</p>
<p>if ($instring==1)</p>
<p>{</p>
<p>//Add the whole string, untouched to the previous value in the array</p>
<p>$result[count($result)-1] = $result[count($result)-1].$val;</p>
<p>$instring = 0;</p>
<p>}</p>
<p>else</p>
<p>{</p>
<p>//Break up the string according to the delimiter character</p>
<p>//Each string has extraneous delimiters around it (inc the ones we added</p>
<p>//above), so they need to be stripped off</p>
<p>$temparray = split($splitter, substr($val, $delimlen, strlen($val)-$delimlen-$delimlen+1 ) );</p>
<p>while(list($iarg, $ival) = each($temparray))</p>
<p>{</p>
<p>$result[] = trim($ival);</p>
<p>}</p>
<p>$instring = 1;</p>
<p>}</p>
<p>}</p>
<p>return $result;</p>
<p>}</p>
<p>wchris</p>
<p>18-Feb-2005 07:53</p>
<p>moritz&#8217;s quotesplit didn&#8217;t work for me. It seemed to split on a comma</p>
<p>even though it was between a pair of quotes. However, this did work:</p>
<p>function quotesplit($s, $splitter=&#8217;,')</p>
<p>{</p>
<p>//First step is to split it up into the bits that are surrounded by</p>
<p>quotes and the bits that aren&#8217;t. Adding the delimiter to the ends</p>
<p>simplifies the logic further down</p>
<p>$getstrings = split(&#8216;\&#8221;&#8216;, $splitter.$s.$splitter);</p>
<p>//$instring toggles so we know if we are in a quoted string or not</p>
<p>$delimlen = strlen($splitter);</p>
<p>$instring = 0;</p>
<p>while (list($arg, $val) = each($getstrings))</p>
<p>{</p>
<p>if ($instring==1)</p>
<p>{</p>
<p>//Add the whole string, untouched to the result array.</p>
<p>$result[] = $val;</p>
<p>$instring = 0;</p>
<p>}</p>
<p>else</p>
<p>{</p>
<p>//Break up the string according to the delimiter character</p>
<p>//Each string has extraneous delimiters around it (inc the ones we added above), so they need to be stripped off</p>
<p>$temparray = split($splitter, substr($val, $delimlen, strlen($val)-$delimlen-$delimlen ) );</p>
<p>while(list($iarg, $ival) = each($temparray))</p>
<p>{</p>
<p>$result[] = trim($ival);</p>
<p>}</p>
<p>$instring = 1;</p>
<p>}</p>
<p>}</p>
<p>return $result;</p>
<p>}</p>
<p>ramkumar rajendran</p>
<p>18-Jan-2005 02:09</p>
<p>A correction to a earlier note</p>
<p>If you want to use split to check on line feeds (\n), the following won&#8217;t work:</p>
<p>$line = split(&#8220;\n&#8221;, $input_several_lines_long);</p>
<p>You really have to do this instead, notice the second slash:</p>
<p>$line = split(&#8220;/\n&#8221;, $input_several_lines_long);</p>
<p>Took me a little while to figure to do</p>
<p>claes at dot2me.com</p>
<p>04-Nov-2004 08:10</p>
<p>Though this is obvious, the manual is a bit incorrect when claiming</p>
<p>that the return will always be 1+number of time the split pattern</p>
<p>occures.  If the split pattern is the first part of the string, the</p>
<p>return will still be 1.  E.g.</p>
<p>$a = split(&#8220;zz,&#8221; &#8220;zzxsj.com&#8221;);</p>
<p>count($a);</p>
<p>=&gt; 1.</p>
<p>The return of this can not in anyway be seperated from the return where the split pattern is not found.</p>
<p>moritz</p>
<p>10-Apr-2004 02:54</p>
<p>Often you want to split CSV-Like data, so this is the function for this <img src='http://www.bthome.com.cn/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>It splits data formatted like:</p>
<p>1,2,3</p>
<p>-&gt; [1,2,3]</p>
<p>1 , 3, 4</p>
<p>-&gt; [1,3,4]</p>
<p>one; two;three</p>
<p>-&gt; ['one','two','three']</p>
<p>&#8220;this is a string&#8221;, &#8220;this is a string with , and ;&#8221;, &#8216;this is a string</p>
<p>with quotes like &#8221; these&#8217;, &#8220;this is a string with escaped quotes \&#8221; and</p>
<p>\&#8217;.&#8221;, 3</p>
<p>-&gt; ['this is a string','this is a string with , and ;','this is a</p>
<p>string with quotes like " these','this is a string with escaped quotes</p>
<p>" and '.',3]</p>
<p>function quotesplit($s)</p>
<p>{</p>
<p>$r = Array();</p>
<p>$p = 0;</p>
<p>$l = strlen($s);</p>
<p>while ($p &lt; $l) {</p>
<p>while (($p &lt; $l) &amp;&amp; (strpos(&#8221; \r\t\n&#8221;,$s[$p]) !== false)) $p++;</p>
<p>if ($s[$p] == &#8216;&#8221;&#8216;) {</p>
<p>$p++;</p>
<p>$q = $p;</p>
<p>while (($p &lt; $l) &amp;&amp; ($s[$p] != &#8216;&#8221;&#8216;)) {</p>
<p>if ($s[$p] == &#8216;\\&#8217;) { $p+=2; continue; }</p>
<p>$p++;</p>
<p>}</p>
<p>$r[] = stripslashes(substr($s, $q, $p-$q));</p>
<p>$p++;</p>
<p>while (($p &lt; $l) &amp;&amp; (strpos(&#8221; \r\t\n&#8221;,$s[$p]) !== false)) $p++;</p>
<p>$p++;</p>
<p>} else if ($s[$p] == &#8220;&#8216;&#8221;) {</p>
<p>$p++;</p>
<p>$q = $p;</p>
<p>while (($p &lt; $l) &amp;&amp; ($s[$p] != &#8220;&#8216;&#8221;)) {</p>
<p>if ($s[$p] == &#8216;\\&#8217;) { $p+=2; continue; }</p>
<p>$p++;</p>
<p>}</p>
<p>$r[] = stripslashes(substr($s, $q, $p-$q));</p>
<p>$p++;</p>
<p>while (($p &lt; $l) &amp;&amp; (strpos(&#8221; \r\t\n&#8221;,$s[$p]) !== false)) $p++;</p>
<p>$p++;</p>
<p>} else {</p>
<p>$q = $p;</p>
<p>while (($p &lt; $l) &amp;&amp; (strpos(&#8220;,;&#8221;,$s[$p]) === false)) {</p>
<p>$p++;</p>
<p>}</p>
<p>$r[] = stripslashes(trim(substr($s, $q, $p-$q)));</p>
<p>while (($p &lt; $l) &amp;&amp; (strpos(&#8221; \r\t\n&#8221;,$s[$p]) !== false)) $p++;</p>
<p>$p++;</p>
<p>}</p>
<p>}</p>
<p>return $r;</p>
<p>}</p>
<p>alphibia at alphibia dot com</p>
<p>31-Mar-2004 10:19</p>
<p>I&#8217;d like to correct myself, I found that after testing my last solution</p>
<p>it will create 5 lines no matter what&#8230; So I added this to make sure</p>
<p>that it only displays 5 if there are five newlines. <img src='http://www.bthome.com.cn/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<p><!--?php</p-->
<p>$MaxNewLines = 5;</p>
<p>$BRCount = substr_count($Message, &#8216;<br />
&#8216;);</p>
<p>if ($BRCount&lt;$MaxNewLines)</p>
<p>$MaxNewLines=$BRCount;</p>
<p>else if($BRCount == 0)</p>
<p>$MaxNewLines=1;</p>
<p>$Message = str_replace(chr(13), &#8221;<br />
&#8220;, $Message);</p>
<p>$MessageArray = split(&#8221;<br />
&#8220;, $Message, $MaxNewLines);</p>
<p>$Message = &#8220;&#8221;; $u=0;</p>
<p>do    {</p>
<p>$Message.=$MessageArray[$u].&#8217;<br />
&#8216;;</p>
<p>$u++;</p>
<p>} while($u&lt;($MaxNewLines-1));</p>
<p>$Message.=str_replace(&#8221;<br />
&#8220;,&#8221; &#8220;,$MessageArray[$u]);</p>
<p>?&gt;</p>
<p>-Tim</p>
<p>http://www.alphibia.com</p>
<p>nomail at please dot now</p>
<p>22-Nov-2003 01:33</p>
<p>If you want to use split to check on line feeds (\n), the following won&#8217;t work:</p>
<p>$line = split(&#8220;\n&#8221;, $input_several_lines_long);</p>
<p>You really have to do this instead, notice the second slash:</p>
<p>$line = split(&#8220;\\n&#8221;, $input_several_lines_long);</p>
<p>Took me a little while to figure out.</p>
<p>krahn at niehs dot nih dot gov</p>
<p>25-Oct-2003 03:14</p>
<p>&gt; strange things happen with split</p>
<p>&gt; this didn&#8217;t work</p>
<p>&gt; $vontag $vonmonat were empty strings</p>
<p>&#8230;</p>
<p>&gt; list ($vontag , $vonmonat) = split (&#8216;.&#8217; , $fromdate); // &lt;&lt; bad</p>
<p>Split is acting exactly as it should; it splits on regular expressions.</p>
<p>A period is a regular expression pattern for a single character.</p>
<p>So, an actual period must be escaped with a backslash:  &#8216;\.&#8217;</p>
<p>A period within brackets is not an any-character pattern, because it does</p>
<p>not make sense in that context.</p>
<p>Beware that regular expressions can be confusing becuase there</p>
<p>are a few different varieties of patterns.</p>
<p>dalu at uni dot de</p>
<p>09-Oct-2003 03:26</p>
<p>php4.3.0</p>
<p>strange things happen with split</p>
<p>this didn&#8217;t work</p>
<p>$vontag $vonmonat were empty strings</p>
<p><!--?php</p-->
<p>function ckdate($fromdate=&#8221;01.01&#8243;, $todate=&#8221;31.12&#8243;)</p>
<p>{</p>
<p>$nowyear = date(&#8220;Y&#8221;);</p>
<p>list ($vontag , $vonmonat) = split (&#8216;.&#8217; , $fromdate); // &lt;&lt; bad</p>
<p>$vondatum = &#8220;$nowyear-$vonmonat-$vontag&#8221;;</p>
<p>list ($bistag , $bismonat) = split (&#8216;.&#8217; , $todate); // &lt;&lt; bad</p>
<p>$bisdatum = &#8220;$nowyear-$bismonat-$bistag&#8221;;</p>
<p>$von = strtotime($vondatum);</p>
<p>$bis = strtotime($bisdatum);</p>
<p>$now = time();</p>
<p>if (($now &lt;= $bis) and ($now &gt;= $von))</p>
<p>{</p>
<p>return TRUE;</p>
<p>}</p>
<p>else</p>
<p>{</p>
<p>return FALSE;</p>
<p>}</p>
<p>}</p>
<p>?&gt;</p>
<p>however this one worked perfectly</p>
<p><!--?php</p-->
<p>function ckdate($fromdate=&#8221;01.01&#8243;, $todate=&#8221;31.12&#8243;)</p>
<p>{</p>
<p>$nowyear = date(&#8220;Y&#8221;);</p>
<p>list ($vontag , $vonmonat) = split (&#8216;[.]&#8216; , $fromdate); // &lt;&lt; good</p>
<p>$vondatum = &#8220;$nowyear-$vonmonat-$vontag&#8221;;</p>
<p>list ($bistag , $bismonat) = split (&#8216;[.]&#8216; , $todate); // &lt;&lt; good</p>
<p>$bisdatum = &#8220;$nowyear-$bismonat-$bistag&#8221;;</p>
<p>$von = strtotime($vondatum);</p>
<p>$bis = strtotime($bisdatum);</p>
<p>$now = time();</p>
<p>if (($now &lt;= $bis) and ($now &gt;= $von))</p>
<p>{</p>
<p>return TRUE;</p>
<p>}</p>
<p>else</p>
<p>{</p>
<p>return FALSE;</p>
<p>}</p>
<p>}</p>
<p>?&gt;</p>
<p>btw this fn checks if $now if between $fromdate and $todate</p>
<p>use it if you like</p>
<p>jeffrey at jhu dot edu</p>
<p>11-Jan-2003 05:51</p>
<p>In answer to gwyne at gmx dot net, dec 1, 2002:</p>
<p>For split(), when using a backslash as the delimiter, you have to *double escape* the backslash.</p>
<p>example:</p>
<p>==================================</p>
<pre><!--?

$line = 'stuff\\\thing\doodad\\';

$linearray = split('\\\\', $line); //< NOTE USE OF FOUR(4)backslashes print join(":", $linearray); ?--></pre>
<p>==================================</p>
<p>output is:</p>
<pre>stuff::thing:doodad:</pre>
<p>paha at paha dot hu</p>
<p>22-Jul-2002 09:51</p>
<p>It&#8217;s evident but not mentioned in the documentation that using asterisks is more restricted than in a normal regular expression.</p>
<p>for exaple you cannot say:</p>
<p>split(&#8220;;*&#8221;,$string);</p>
<p>because what if there&#8217;s no &#8220;;&#8221; separator?(which is covered by this regular expression)</p>
<p>so you have to use at least</p>
<p>split(&#8220;;+&#8221;,$quotatxt);</p>
<p>in this situation.</p>
<p>fotw at gmx dot net</p>
<p>18-Jun-2002 03:50</p>
<p>Ups! It seems that neither explode nor split REALY takes a STRING but</p>
<p>only a single character as a string for splitting the string.</p>
<p>I found this problem in one of my codes when trying to split a string</p>
<p>using &#8220;;\n&#8221; as breaking string. The result, only &#8220;;&#8221; was thaken&#8230; the</p>
<p>rest of the string was ignored.</p>
<p>Same when I tried to substitute &#8220;\n&#8221; by any other thing. <img src='http://www.bthome.com.cn/wp-includes/images/smilies/icon_sad.gif' alt=':(' class='wp-smiley' /> </p>
<p>not at anythingspecial dot com</p>
<p>17-Jun-2002 09:48</p>
<p>If you need to do a split on a period make sure you escape the period out..</p>
<p>$ext_arr = split(&#8220;\.&#8221;,&#8221;something.jpg&#8221;);</p>
<p>&#8230; because</p>
<p>$ext_arr = split(&#8220;.&#8221;,&#8221;something.jpg&#8221;); won&#8217;t work properly.</p>
<p>kang at elpmis dot com</p>
<p>13-Jun-2002 02:30</p>
<p>This is a good way to display a comma delimited file with two columns.</p>
<p>The first column is the URL&#8217;s description, the second is the actual URL.</p>
<ul><!--?php</p-->
<p>$fname=&#8221;relatedlinks.csv&#8221;;</p>
<p>$fp=fopen($fname,&#8221;r&#8221;) or die(&#8220;Error found.&#8221;);</p>
<p>$line = fgets( $fp, 1024 );</p>
<p>while(!feof($fp))</p>
<p>{</p>
<p>list($desc,$url,$dummy) = split( &#8220;,&#8221;, $line, 3 );</p>
<p>print &#8221;</p>
<li>&#8220;;
<p>print &#8220;<a href="$url">$desc</a>&#8220;;</p>
<p>print &#8220;</li>
<p>\n&#8221;;</p>
<p>$line = fgets( $fp, 1024 );</p>
<p>}</p>
<p>fclose($fp);</p>
<p>?&gt;</ul>
<p>jchart at sdccu dot net</p>
<p>01-Jun-2002 03:56</p>
<p>[Ed. note: Close. The pipe *is* an operator in PHP, but</p>
<p>the reason this fails is because it's also an operator</p>
<p>in the regex syntax. The distinction here is important</p>
<p>since a PHP operator inside a string is just a character.]</p>
<p>The reason your code:</p>
<p>$line = &#8220;12|3|Fred&#8221;;</p>
<p>list ($msgid, $msgref, $msgtopic)=split(&#8216;|&#8217;, $line);</p>
<p>didn&#8217;t work is because the &#8220;|&#8221; symbol is an operator in PHP. If you</p>
<p>want to use the pipe symbol as a delimiter you must excape it with a</p>
<p>back slash, &#8220;\|&#8221;. You code should look like this:</p>
<p>$line = &#8220;12|3|Fred&#8221;;</p>
<p>list ($msgid, $msgref, $msgtopic)=split(&#8216;\|&#8217;, $line);</p>
<p>mcgarry at tig dot com dot au</p>
<p>17-May-2002 06:27</p>
<p>split() doesn&#8217;t like NUL</p>
<p>characters within the string, it treats the first one it meets as the</p>
<p>end of the string, so if you have data you want to split that can</p>
<p>contain a NUL character you&#8217;ll need to convert it into something else</p>
<p>first, eg:</p>
<p>$line=str_replace(chr(0),&#8221;,$line);</p>
]]></content:encoded>
			<wfw:commentRss>http://www.bthome.com.cn/2010/12/22/split-%e7%94%a8%e6%ad%a3%e5%88%99%e8%a1%a8%e8%be%be%e5%bc%8f%e5%b0%86%e5%ad%97%e7%ac%a6%e4%b8%b2%e5%88%86%e5%89%b2%e5%88%b0%e6%95%b0%e7%bb%84%e4%b8%ad/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHP过滤HTML字符串</title>
		<link>http://www.bthome.com.cn/2010/12/22/php%e8%bf%87%e6%bb%a4html%e5%ad%97%e7%ac%a6%e4%b8%b2/</link>
		<comments>http://www.bthome.com.cn/2010/12/22/php%e8%bf%87%e6%bb%a4html%e5%ad%97%e7%ac%a6%e4%b8%b2/#comments</comments>
		<pubDate>Wed, 22 Dec 2010 08:09:30 +0000</pubDate>
		<dc:creator>administrator</dc:creator>
				<category><![CDATA[php]]></category>
		<category><![CDATA[PHP过滤]]></category>
		<category><![CDATA[字符串]]></category>

		<guid isPermaLink="false">http://www.bthome.com.cn/?p=93</guid>
		<description><![CDATA[&#60;?php /******************************************************************** * 原文件名：Filter1.php * 文件说明：过滤HTML字符串 * 文件编写：xuefengal@sohu.com * 流程说明： * 当附合要求的参数传递进filter函数后,filter()函数首先 * 把要字串中所有要过滤的标签$tag通过preg_match_all() * 取出来,然后循环preg_match_all的匹配数组,通过preg_split() * 函数分割每个标签为 &#8220;左边属性&#8221; = &#8220;右边值&#8221;的形式,再从要保 * 留的属性数组中循环,将preg_split()匹配的内容对应取出,构成 * 可以替换的值,后最通过str_replcae()替换掉字串中相应的标签 * 函数列表： * function filter(&#38;$str,$tag,$keep_attribute) * function match($reg,&#38;$str,$arr) * function show($str,$title=&#8221;,$debug = True) * 使用示例： * //取得搜狐新闻首页 * $str = @file_get_content(&#8220;http://news.sohu.com&#8221;); * //过滤 * filter($str,&#8217;a',&#8217;href,target,alt&#8217;); * filter($str,&#8217;p',&#8217;align&#8217;); * show($str,&#8217;过滤后的内容&#8217;); ********************************************************************/ [...]]]></description>
			<content:encoded><![CDATA[<p>&lt;?php<br />
/********************************************************************<br />
* 原文件名：Filter1.php<br />
* 文件说明：过滤HTML字符串<br />
* 文件编写：xuefengal@sohu.com<br />
* 流程说明：<br />
* 当附合要求的参数传递进filter函数后,filter()函数首先<br />
* 把要字串中所有要过滤的标签$tag通过preg_match_all()<br />
* 取出来,然后循环preg_match_all的匹配数组,通过preg_split()<br />
* 函数分割每个标签为 &#8220;左边属性&#8221; = &#8220;右边值&#8221;的形式,再从要保<br />
* 留的属性数组中循环,将preg_split()匹配的内容对应取出,构成<br />
* 可以替换的值,后最通过str_replcae()替换掉字串中相应的标签<br />
* 函数列表：<br />
* function filter(&amp;$str,$tag,$keep_attribute)<br />
* function match($reg,&amp;$str,$arr)<br />
* function show($str,$title=&#8221;,$debug = True)<br />
* 使用示例：<br />
* //取得搜狐新闻首页<br />
* $str = @file_get_content(&#8220;http://news.sohu.com&#8221;);<br />
* //过滤<br />
* filter($str,&#8217;a',&#8217;href,target,alt&#8217;);<br />
* filter($str,&#8217;p',&#8217;align&#8217;);<br />
* show($str,&#8217;过滤后的内容&#8217;);<br />
********************************************************************/</p>
<p>$start_time = array_sum(explode(&#8221; &#8220;,microtime()));</p>
<p>$str = &lt;&lt;&lt; HTML<br />
&lt;A style=&#8221;a&#8221; target=_blank href=&#8217;http://www.a.com&#8217; xxx=xadsfa alt=&#8221;a a a&#8221; style=&#8221;aa&#8221;&gt;site a&lt;/A&gt;<br />
&lt;A alt=&#8217;b b b&#8217; xxx=xadsfa target=_blank href=&#8217;http://www.b.com&#8217; style=&#8221;b&#8221; style=&#8221;bb&#8221;&gt;site b&lt;/A&gt;<br />
&lt;A xxx=xadsfa style=&#8221;c&#8221; href=&#8217;http://www.c.com&#8217; target=_blank alt=c c c style=&#8221;cc&#8221;&gt;site c&lt;/A&gt;<br />
&lt;A style=&#8221;d&#8221; href=&#8217;http://www.d.com&#8217; xxx=xadsfa alt=d d d target=_blank style=&#8221;dd&#8221;&gt;site d&lt;/A&gt;<br />
&lt;A target=_blank style=&#8221;e&#8221; xxx=xadsfa style=&#8221;ee&#8221; alt=e e e href=&#8217;http://www.e.com&#8217;&gt;site e&lt;/A&gt;</p>
<p>&lt;p align=right style=&#8221;font-size:10px&#8221;&gt;adasdfasdf&lt;/p&gt;<br />
&lt;p style=&#8221;font-color:red;&#8221; align=&#8217;left&#8217;&gt;asdfasdfasdfasdf&lt;/p&gt;<br />
&lt;p align=left right center&gt;asdfasdfasdf&lt;/p&gt;</p>
<p>&lt;font color=&#8221;red&#8221; alt=adasd adsasd&gt;asdfadsfasdf&lt;/font&gt;<br />
&lt;font align=&#8217;left&#8217; color=red&gt;asdfasdfadf&lt;/font&gt;<br />
&lt;font align=left right color=red black&gt;asdfasdf&lt;/font&gt;<br />
HTML;</p>
<p>//显示原字串<br />
show($str,&#8217;Html&#8217;);</p>
<p>/***********************************************************************************************************************************************************************/<br />
//过滤<br />
filter($str,&#8217;a',&#8217;href,target,alt&#8217;);<br />
filter($str,&#8217;p',&#8217;align&#8217;);<br />
filter($str,&#8217;font&#8217;,'color,alt&#8217;);</p>
<p>//显示过滤后的内容<br />
show($str,&#8217;Result&#8217;);</p>
<p>//脚本运行时间<br />
$run_time = array_sum(explode(&#8221; &#8220;,microtime())) &#8211; $start_time;<br />
echo(&#8216;&lt;center&gt;Script Run Time: &#8216;.$run_time.&#8217;&lt;/center&gt;&#8217;);</p>
<p>/**<br />
* 说明：过滤HTML字串<br />
* 参数：<br />
* $str : 要过滤的HTML字串<br />
* $tag : 过滤的标签类型<br />
* $keep_attribute :<br />
* 要保留的属性,此参数形式可为<br />
* href<br />
* href,target,alt<br />
* array(&#8216;href&#8217;,'target&#8217;,'alt&#8217;)<br />
*/<br />
function filter(&amp;$str,$tag,$keep_attribute) {</p>
<p>//检查要保留的属性的参数传递方式<br />
if(!is_array($keep_attribute)) {<br />
//没有传递数组进来时判断参数是否包含,号<br />
if(strpos($keep_attribute,&#8217;,')) {<br />
//包含,号时,切分参数串为数组<br />
$keep_attribute = explode(&#8216;,&#8217;,$keep_attribute);<br />
}else {<br />
//纯字串,构造数组<br />
$keep_attribute = array($keep_attribute);<br />
}<br />
}</p>
<p>echo(&#8220;·过滤[$tag]标签,保留属性:&#8221;.implode(&#8216;,&#8217;,$keep_attribute).&#8217;&lt;br&gt;&#8217;);</p>
<p>//取得所有要处理的标记<br />
$pattern = &#8220;/&lt;$tag(.*)&lt;\/$tag&gt;/i&#8221;;<br />
preg_match_all($pattern,$str,$out);</p>
<p>//循环处理每个标记<br />
foreach($out[1] as $key =&gt; $val) {<br />
//取得a标记中有几个=<br />
$cnt = preg_split(&#8216;/ *=/i&#8217;,$val);<br />
$cnt = count($cnt) -1;</p>
<p>//构造匹配正则<br />
$pattern = &#8221;;<br />
for($i=1; $i&lt;=$cnt; $i++) {</p>
<p>$pattern .= &#8216;( .*=.*)&#8217;;<br />
}<br />
//完成正则表达式形成,如/(&lt;a)( .*=.*)( .*=.*)(&gt;.*&lt;\/a&gt;/i的样式<br />
$pattern = &#8220;/(&lt;$tag)$pattern(&gt;.*&lt;\/$tag&gt;)/i&#8221;;</p>
<p>//取得保留属性<br />
$replacement = match($pattern,$out[0][$key],$keep_attribute);</p>
<p>//替换<br />
$str = str_replace($out[0][$key],$replacement,$str);<br />
}<br />
}</p>
<p>/**<br />
* 说明：构造标签,保留要保留的属性<br />
* 参数：$reg : pattern,preg_match的表达式<br />
* $str : string,html字串<br />
* $arr : array,要保留的属性<br />
* 返回：<br />
* 返回经保留处理后的标签,如<br />
* &lt;A href=&#8217;http://www.e.com&#8217; target=_blank alt=e e e&gt;e.com&lt;/A&gt;<br />
*/<br />
function match($reg,&amp;$str,$arr) {</p>
<p>//match<br />
preg_match($reg,$str,$out);</p>
<p>//取出保留的属性<br />
$keep_attribute = &#8221;;<br />
foreach($arr as $k1=&gt;$v1) {<br />
//定义的要保留的属性的数组<br />
foreach($out as $k2=&gt;$v2) {<br />
//匹配=后的数组<br />
$attribute = trim(substr($v2,0,strpos($v2,&#8217;=')));<br />
//=前面的<br />
if($v1 == $attribute) {<br />
//要保留的属性和匹配的值的=前的部分相同<br />
$keep_attribute .= $v2;<br />
//保存此匹配部分的值<br />
}<br />
}</p>
<p>}</p>
<p>//构造返回值,结构如:&lt;a href=xxx target=xxx&gt;aadd&lt;/a&gt;<br />
$keep_attribute = $out[1].$keep_attribute.($out[count($out)-1]);<br />
//返回值<br />
Return $keep_attribute;<br />
}</p>
<p>/**<br />
* 显示字串内容<br />
*/<br />
function show($str,$title=&#8221;,$debug = True) {</p>
<p>if($debug) {<br />
if(is_array($str)) {<br />
$str = print_r($str,True);<br />
}<br />
$txtRows = count(explode(&#8220;\n&#8221;,$str))+1;<br />
echo($title.&#8217;:&lt;br&gt;&lt;TEXTAREA NAME=&#8221;txt&#8221; ROWS=&#8221;&#8216;.$txtRows.&#8217;&#8221; COLS=&#8221;130&#8243;&gt;&#8217;.$str.&#8217;&lt;/TEXTAREA&gt;&lt;br&gt;&lt;br&gt;&#8217;);<br />
}</p>
<p>}</p>
<p>?&gt;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.bthome.com.cn/2010/12/22/php%e8%bf%87%e6%bb%a4html%e5%ad%97%e7%ac%a6%e4%b8%b2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>在PHP中过滤匿名代理与透明代理的方法</title>
		<link>http://www.bthome.com.cn/2010/12/22/%e5%9c%a8php%e4%b8%ad%e8%bf%87%e6%bb%a4%e5%8c%bf%e5%90%8d%e4%bb%a3%e7%90%86%e4%b8%8e%e9%80%8f%e6%98%8e%e4%bb%a3%e7%90%86%e7%9a%84%e6%96%b9%e6%b3%95/</link>
		<comments>http://www.bthome.com.cn/2010/12/22/%e5%9c%a8php%e4%b8%ad%e8%bf%87%e6%bb%a4%e5%8c%bf%e5%90%8d%e4%bb%a3%e7%90%86%e4%b8%8e%e9%80%8f%e6%98%8e%e4%bb%a3%e7%90%86%e7%9a%84%e6%96%b9%e6%b3%95/#comments</comments>
		<pubDate>Wed, 22 Dec 2010 08:08:04 +0000</pubDate>
		<dc:creator>administrator</dc:creator>
				<category><![CDATA[php]]></category>
		<category><![CDATA[代理]]></category>
		<category><![CDATA[过滤代理]]></category>

		<guid isPermaLink="false">http://www.bthome.com.cn/?p=91</guid>
		<description><![CDATA[为了保护网站的资源，我们通常会不允许代理访问我们的网站，以下方法可以过滤掉所有匿名代理与透明代理，但不能过滤超级代理，同时他们过滤掉局域网的代理，所以如果要正常使用，可能还要做些必要的修改！ ＄proxy = 0; if(＄_SERVER['HTTP_VIA'] != &#8220;&#8221;) { ＄proxy = 1; } if(＄_SERVER['HTTP_X_FORWARDED_FOR'] != &#8220;&#8221;) { ＄proxy = 1; } if(＄_SERVER['VIA'] != &#8220;&#8221;) { ＄proxy = 1; } if(＄_SERVER['HTTP_FORWARDED'] != &#8220;&#8221;) { ＄proxy = 1; } if(＄_SERVER['FORWARDED'] != &#8220;&#8221;) { ＄proxy = 1; } if(＄_SERVER['HTTP_X_BLUECOAT_VIA'] != &#8220;&#8221;) { ＄proxy = 1; } if(＄_SERVER['HTTP_PROXY____'] != &#8220;&#8221;) [...]]]></description>
			<content:encoded><![CDATA[<p>为了保护网站的资源，我们通常会不允许代理访问我们的网站，以下方法可以过滤掉所有匿名代理与透明代理，但不能过滤超级代理，同时他们过滤掉局域网的代理，所以如果要正常使用，可能还要做些必要的修改！<br />
＄proxy = 0;<br />
if(＄_SERVER['HTTP_VIA'] != &#8220;&#8221;)<br />
{ ＄proxy = 1; }<br />
if(＄_SERVER['HTTP_X_FORWARDED_FOR'] != &#8220;&#8221;)<br />
{ ＄proxy = 1; }<br />
if(＄_SERVER['VIA'] != &#8220;&#8221;)<br />
{ ＄proxy = 1; }<br />
if(＄_SERVER['HTTP_FORWARDED'] != &#8220;&#8221;)<br />
{ ＄proxy = 1; }<br />
if(＄_SERVER['FORWARDED'] != &#8220;&#8221;)<br />
{ ＄proxy = 1; }<br />
if(＄_SERVER['HTTP_X_BLUECOAT_VIA'] != &#8220;&#8221;)<br />
{ ＄proxy = 1; }<br />
if(＄_SERVER['HTTP_PROXY____'] != &#8220;&#8221;)<br />
{ ＄proxy = 1; }<br />
if(＄_SERVER['HTTP_PROXY___________'] != &#8220;&#8221;)<br />
{ ＄proxy = 1; }<br />
if(＄_SERVER['HTTP_PROXY_CONNECTION'] != &#8220;&#8221;)<br />
{ ＄proxy = 1; }<br />
if(＄_SERVER['HTTP_X_HOST'] != &#8220;&#8221;)<br />
{ ＄proxy = 1; }<br />
if(＄_SERVER['HTTP_X_REFERER'] != &#8220;&#8221;)<br />
{ ＄proxy = 1; }<br />
if(＄_SERVER['HTTP_X_SERVER_HOSTNAME'] != &#8220;&#8221;)<br />
{ ＄proxy = 1; }<br />
if(＄_SERVER['PROXY_HOST'] != &#8220;&#8221;)<br />
{ ＄proxy = 1; }<br />
if(＄_SERVER['PROXY_PORT'] != &#8220;&#8221;)<br />
{ ＄proxy = 1; }<br />
if(＄_SERVER['PROXY_REQUEST'] != &#8220;&#8221;)<br />
{ ＄proxy = 1; }<br />
if(＄_SERVER['HTTP_CLIENT_IP'] != &#8220;&#8221;)<br />
{ ＄proxy = 1; }<br />
if(＄_SERVER['HTTP_PRAGMA'] != &#8220;&#8221;)<br />
{ ＄proxy = 1; }</p>
]]></content:encoded>
			<wfw:commentRss>http://www.bthome.com.cn/2010/12/22/%e5%9c%a8php%e4%b8%ad%e8%bf%87%e6%bb%a4%e5%8c%bf%e5%90%8d%e4%bb%a3%e7%90%86%e4%b8%8e%e9%80%8f%e6%98%8e%e4%bb%a3%e7%90%86%e7%9a%84%e6%96%b9%e6%b3%95/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>在PHP中如何用正则表达式验证IP地址</title>
		<link>http://www.bthome.com.cn/2010/12/22/%e5%9c%a8php%e4%b8%ad%e5%a6%82%e4%bd%95%e7%94%a8%e6%ad%a3%e5%88%99%e8%a1%a8%e8%be%be%e5%bc%8f%e9%aa%8c%e8%af%81ip%e5%9c%b0%e5%9d%80-2/</link>
		<comments>http://www.bthome.com.cn/2010/12/22/%e5%9c%a8php%e4%b8%ad%e5%a6%82%e4%bd%95%e7%94%a8%e6%ad%a3%e5%88%99%e8%a1%a8%e8%be%be%e5%bc%8f%e9%aa%8c%e8%af%81ip%e5%9c%b0%e5%9d%80-2/#comments</comments>
		<pubDate>Wed, 22 Dec 2010 08:03:52 +0000</pubDate>
		<dc:creator>administrator</dc:creator>
				<category><![CDATA[php]]></category>
		<category><![CDATA[正则表达式]]></category>

		<guid isPermaLink="false">http://www.bthome.com.cn/?p=85</guid>
		<description><![CDATA[方法一： IP地址，可能都比较熟悉吧，就是由0-255间的数字，并由 . 隔开组成的。定义非常简单，而用正则表达式检验，同样也非常简单。 下面，我们来看看正则表达式是如何表示的： /\A((([0-9]?[0-9])&#124;(1[0-9]{2})&#124;(2[0-4][0-9])&#124;(25[0-5]))\.){3}(([0-9]?[0-9])&#124;(1[0-9]{2})&#124;(2[0-4][0-9])&#124;(25[0-5]))\Z/ 这就是表示IP地址的正则表达式，别吓跑了。下面我们来详细说一下他是如何表示的。首先，我要说明的是开始和结尾的“/”是定界符，不代表什么，而 \A 和 \Z 分别代表开始和结尾，接下来，我们把中间的部分拆成两段，((([0-9]?[0-9])&#124;(1[0-9]{2})&#124;(2[0-4][0-9])&#124;(25[0-5]))\.){3}，这是第一段，我们用不同的颜色标出了圆括号的对应位置。最后的{3}表示最红括号里的内容出现3次。而蓝色括号里的就是表示每一位数字的表示。\. 表示 . 号本身，也就是前三个数字后有点号。现在我们分析最关键的地方，如何表示0-255这些数字。即蓝色括号里的内容。 这些数字可能是一位，两位或三位，我们用符号（&#124;）来表示，当一位或两位时，请看第一个([0-9]?[0-9]) ，问号表示出现0次或1次，这就代表了0-99之间的数字。当数字为三位数时，我们又分三种情况，1-199：我们表示为(1[0-9]{2})，200-249：我们表示为(2[0-4][0-9])，250-255：我们表示为(25[0-5])。这四种能匹配任何一种，都是0-255的范围内，整个前部分的意思就是由三个0-255的数字加小数点组成。后一部分就不用说了，就是前面数字部分的复制。只表示一个数字。现在把它整理成为一个函数。以供参考： /** * 检查IP地址是否正确。 */ function checkipaddres ($ipaddres) { $preg=&#8221;/\A((([0-9]?[0-9])&#124;(1[0-9]{2})&#124;(2[0-4][0-9])&#124;(25[0-5]))\.){3}(([0-9]?[0-9])&#124;(1[0-9]{2})&#124;(2[0-4][0-9])&#124;(25[0-5]))\Z/&#8221;; if(preg_match($preg,$ipaddres))return true; return false; } 方法二： CODE:function IP2V(ip) { re=/(\d+)\.(\d+)\.(\d+)\.(\d+)/g //匹配IP地址的正则表达式 if(re.test(ip)) { return RegExp.$1*Math.pow(255,3))+RegExp.$2*Math.pow(255,2))+RegExp.$3*255+RegExp.$4*1 } else { throw new Error(&#8220;不是一个正确的IP地址!&#8221;) } }[ ]]]></description>
			<content:encoded><![CDATA[<p style="padding-left: 30px;">方法一：</p>
<p>IP地址，可能都比较熟悉吧，就是由0-255间的数字，并由 . 隔开组成的。定义非常简单，而用正则表达式检验，同样也非常简单。</p>
<p>下面，我们来看看正则表达式是如何表示的：<br />
/\A((([0-9]?[0-9])|(1[0-9]{2})|(2[0-4][0-9])|(25[0-5]))\.){3}(([0-9]?[0-9])|(1[0-9]{2})|(2[0-4][0-9])|(25[0-5]))\Z/<br />
这就是表示IP地址的正则表达式，别吓跑了。下面我们来详细说一下他是如何表示的。首先，我要说明的是开始和结尾的“/”是定界符，不代表什么，而 \A 和 \Z 分别代表开始和结尾，接下来，我们把中间的部分拆成两段，<span style="color: #ff0000;">(</span><span style="color: #0000ff;">(</span>([0-9]?[0-9])|(1[0-9]{2})|(2[0-4][0-9])|(25[0-5])<span style="color: #0000ff;">)</span>\.<span style="color: #ff0000;">)</span>{3}，这是第一段，我们用不同的颜色标出了圆括号的对应位置。最后的{3}表示最红括号里的内容出现3次。而蓝色括号里的就是表示每一位数字的表示。\. 表示 . 号本身，也就是前三个数字后有点号。现在我们分析最关键的地方，如何表示0-255这些数字。即蓝色括号里的内容。</p>
<p>这些数字可能是一位，两位或三位，我们用符号（|）来表示，当一位或两位时，请看第一个([0-9]?[0-9]) ，问号表示出现0次或1次，这就代表了0-99之间的数字。当数字为三位数时，我们又分三种情况，1-199：我们表示为(1[0-9]{2})，200-249：我们表示为(2[0-4][0-9])，250-255：我们表示为(25[0-5])。这四种能匹配任何一种，都是0-255的范围内，整个前部分的意思就是由三个0-255的数字加小数点组成。后一部分就不用说了，就是前面数字部分的复制。只表示一个数字。现在把它整理成为一个函数。以供参考：</p>
<p>/**<br />
* 检查IP地址是否正确。<br />
*/<br />
function checkipaddres ($ipaddres) {<br />
$preg=&#8221;/\A((([0-9]?[0-9])|(1[0-9]{2})|(2[0-4][0-9])|(25[0-5]))\.){3}(([0-9]?[0-9])|(1[0-9]{2})|(2[0-4][0-9])|(25[0-5]))\Z/&#8221;;<br />
if(preg_match($preg,$ipaddres))return true;<br />
return false;<br />
}</p>
<p style="padding-left: 30px;">方法二：</p>
<p>CODE:function IP2V(ip)<br />
{<br />
re=/(\d+)\.(\d+)\.(\d+)\.(\d+)/g //匹配IP地址的正则表达式<br />
if(re.test(ip))<br />
{<br />
return RegExp.$1*Math.pow(255,3))+RegExp.$2*Math.pow(255,2))+RegExp.$3*255+RegExp.$4*1<br />
}<br />
else<br />
{<br />
throw new Error(&#8220;不是一个正确的IP地址!&#8221;)<br />
}<br />
}[<em> </em>]</p>
]]></content:encoded>
			<wfw:commentRss>http://www.bthome.com.cn/2010/12/22/%e5%9c%a8php%e4%b8%ad%e5%a6%82%e4%bd%95%e7%94%a8%e6%ad%a3%e5%88%99%e8%a1%a8%e8%be%be%e5%bc%8f%e9%aa%8c%e8%af%81ip%e5%9c%b0%e5%9d%80-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>如何在Windows 7上运行VMware vSphere Client</title>
		<link>http://www.bthome.com.cn/2010/12/22/%e5%a6%82%e4%bd%95%e5%9c%a8windows-7%e4%b8%8a%e8%bf%90%e8%a1%8cvmware-vsphere-client/</link>
		<comments>http://www.bthome.com.cn/2010/12/22/%e5%a6%82%e4%bd%95%e5%9c%a8windows-7%e4%b8%8a%e8%bf%90%e8%a1%8cvmware-vsphere-client/#comments</comments>
		<pubDate>Wed, 22 Dec 2010 03:11:21 +0000</pubDate>
		<dc:creator>administrator</dc:creator>
				<category><![CDATA[虚拟化]]></category>
		<category><![CDATA[VMware vSphere Client]]></category>

		<guid isPermaLink="false">http://www.bthome.com.cn/?p=80</guid>
		<description><![CDATA[1. 介绍 VMware已有明确说明vSphere Client目前不能运行在Windows 7上，请看此KB:http://kb.vmware.com/kb/1011329 那么如果你要尝鲜使用Windows 7，又要使用vSphere Client怎么办呢，ebanban studio将为你提供解决方法。 2. 方法 (1)首先，你需要下载system.dll (解压密码为: blog.ebanban.com) (2)下载完成后需要将system.dll放在指定目录 32位Windows 7放在C:\Program Files\VMware\Infrastructure\Virtual Infrastructure Client\Launcher\Lib 64位Windows 7放在C:\Program Files (x86)\VMware\Infrastructure\Virtual Infrastructure Client\Launcher\Lib 注意：若Lib目录不存在，则在Launcher目录下创建Lib目录 (3)修改Launcher目录下的VpxClient.exe.config，修改以下代码 &#60;runtime&#62; &#60;developmentMode developerInstallation=”true”/&#62; &#60;/runtime&#62; 注意：若系统提示你无法保存文件，则关闭所有VMware相关的程序再进行保存。 (4)修改你的环境变量 添加变量名DEVPATH 32位Windows 7的键值为C:\Program Files\VMware\Infrastructure\Virtual Infrastructure Client\Launcher\Lib 32位Windows 7的键值为C:\Program Files (x86)\VMware\Infrastructure\Virtual Infrastructure Client\Launcher\Lib]]></description>
			<content:encoded><![CDATA[<p>1. 介绍<br />
VMware已有明确说明vSphere Client目前不能运行在Windows 7上，请看此KB:<a href="http://kb.vmware.com/kb/1011329" target="_blank">http://kb.vmware.com/kb/1011329</a><br />
那么如果你要尝鲜使用Windows 7，又要使用vSphere Client怎么办呢，ebanban studio将为你提供解决方法。</p>
<p>2. 方法<br />
(1)首先，你需要下载<a href="http://blog.ebanban.com/wp-content/uploads/2009/10/blog.ebanban.com_system.dll.zip" target="_self">system.dll</a> (解压密码为: blog.ebanban.com)</p>
<p>(2)下载完成后需要将system.dll放在指定目录<br />
32位Windows 7放在C:\Program Files\VMware\Infrastructure\Virtual Infrastructure Client\Launcher\Lib<br />
64位Windows 7放在C:\Program Files (x86)\VMware\Infrastructure\Virtual Infrastructure Client\Launcher\Lib<br />
注意：若Lib目录不存在，则在Launcher目录下创建Lib目录</p>
<p>(3)修改Launcher目录下的VpxClient.exe.config，修改以下代码<br />
&lt;runtime&gt;<br />
&lt;developmentMode developerInstallation=”true”/&gt;<br />
&lt;/runtime&gt;<br />
注意：若系统提示你无法保存文件，则关闭所有VMware相关的程序再进行保存。</p>
<p>(4)修改你的环境变量<br />
添加变量名DEVPATH<br />
32位Windows 7的键值为C:\Program Files\VMware\Infrastructure\Virtual Infrastructure Client\Launcher\Lib<br />
32位Windows 7的键值为C:\Program Files (x86)\VMware\Infrastructure\Virtual Infrastructure Client\Launcher\Lib</p>
]]></content:encoded>
			<wfw:commentRss>http://www.bthome.com.cn/2010/12/22/%e5%a6%82%e4%bd%95%e5%9c%a8windows-7%e4%b8%8a%e8%bf%90%e8%a1%8cvmware-vsphere-client/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>VMware ESX Server常见问题</title>
		<link>http://www.bthome.com.cn/2010/11/13/vmware-esx-server%e5%b8%b8%e8%a7%81%e9%97%ae%e9%a2%98/</link>
		<comments>http://www.bthome.com.cn/2010/11/13/vmware-esx-server%e5%b8%b8%e8%a7%81%e9%97%ae%e9%a2%98/#comments</comments>
		<pubDate>Sat, 13 Nov 2010 13:59:46 +0000</pubDate>
		<dc:creator>administrator</dc:creator>
				<category><![CDATA[虚拟化]]></category>
		<category><![CDATA[esx]]></category>
		<category><![CDATA[vmware]]></category>

		<guid isPermaLink="false">http://www.bthome.com.cn/?p=76</guid>
		<description><![CDATA[在这里，我们记录一些在ESX主机上发生的、相当常见的问题。通常，可以采取一些简单的步骤去解决这些问题，但有的问题就需要较深入的解决方法。 紫屏死机(PSoDs， Purple Screen of Death) 有一种在ESX和ESXi主机上都可能发生的故障，叫做紫屏死机(可以说是臭名昭著的微软蓝屏死机的VMware版)。紫屏死机会导致ESX/或ESXi主机突然崩溃、变得无法操作。紫屏死机现象如图10.6所示，你一定不希望在自己的主机上发生这种现象。 图10.6 ESX主机上的紫屏死机现象 当PSoDs发生时，ESX会完全死机，没有任何反应。硬件问题(坏有问题的内存是最常见的原因)或ESX中的BUG是导致PSoDs的典型原因。当PSoDs发生时，你只能关闭并重启主机。屏幕上的提示信息非常有用，应该尝试记录它：可以使用带有拍照功能的手机给它照相，或者，如果存在的话，可以从一个远程管理面板上截图。你或许看不明白这些捕获下来的信息，但是，这些信息对VMware的技术支持来说非常有用。屏幕上显示的信息包括ESX的版本和build号、异常类型、寄存器转储(register dump)、崩溃时每个CPU正在跑什么、回溯追踪(back-trace)、服务器运行时间、错误日志、内存硬件信息等。 当你遇到PSoDs并重启主机之后，在ESX主机或/root文件夹下，会有一个以vmkernel-zdump开头(命名)的文件。这个文件对VMware技术支持非常有用，同时，你也可以使用该文件，通过vmkdump工具提取 VMkernel日志信息、寻找与PSoDs有关的线索，从而判断PSoDs发生的原因。要使用这个命令，输入vmkdump –l dump &#60;文件名&#62;。如前所述，坏有问题的内存是PSoDs中常见的原因。 你可以使用dump 文件识别引起问题的内存模块，从而将其替换掉。 如果怀疑是坏内存引起PSoDs，可以使用一些内存压力测试工具来检测主机的内存。这些工具需要你关闭主机并从CD启动以进行内存测试。一个常用的工具是Memtest86+，它可以进行广泛的内存测试，比如，检测邻近内存单元的相互影响，以确保要写某单元时不会覆盖邻近的单元。你可以在www.memtest.org下载这个工具。 当你在某个主机上首次部署ESX的时候，进行一次内存测试是个好主意，这样可以避免在以后某个时候内存故障引起麻烦。许多的内存问题都是不明显的，简单的内存测试，比如POST过程中的内存校验可能都发现不了问题。你可以下载Memtest86+测试工具，一个2MB大小的ISO文件，将这个文件刻录成CD，让主机从该CD启动，然后运行该工具至少24小时以完成多种内存测试。主机中的内存越大，完成一次测试的时间越长，一个拥有32GB内存的主机完成一次测试大概需要1天的时间。除了系统内存，Memtest86+还检测CPU的L1和L2 cache。Memtest86+的运行时间不确定，当所有的测试都完成时，通过的计数器会增加。(Memtest86+ will run indefinitely, and the pass counter will increment as all the tests are run.) 服务器控制台问题 有时候，你可能会遇到服务器控制台问题，表现为：服务器控制台挂起，同时，不允许在本地登录。这种状况可能是由硬件锁定或僵尸状态引起，但是，通常这种问题不会影响在ESX主机上运行的虚拟机(VM)。重启是解决这种问题的常用方法，但是，在重启之前，你应该关闭VM，或者将VM VMmotion到其他的ESX。可以使用各种可用的途径来操作VM，完成关闭或迁移。比如，使用VI client、通过SSH登录到服务控制台或者使用可替代的/紧急的控制台(通过按Alt+F2到F6)。当VM被迁移或者关闭之后，你可以使用reboot命令重启ESX，如果所有的控制台都没有响应，你就只能去按主机上的电源按钮，冷启动主机。 网络问题 有时，你也会遇到某种故障导致丢失了所有或者部分的网络配置，或者网络配置改变导致服务控制台丢失网络连接。当服务控制台的网络连接丢失时，你将无法使用远程的方法来连接ESX主机，包括VI client和SSH。你只能在本地的服务控制台上使用esxcfg-命令行工具恢复/修正网络配置，以下是一些命令，你可以从ESX CLI上使用它们配置网络： esxcfg-nics 这个命令显示物理网卡列表，除去每个网卡的驱动信息、PCI设备、链接状态，你可以使用这个命令控制物理网卡的速度、双工模式等。esxcfg-nics –l显示网卡信息、esxcfg-nics –h显示该命令可用的选项，以下是一些例子： o设置物理网卡vmnic2的速度和双工模式为100/Full: esxcfg-nics -s 100 -d full vmnic2 [...]]]></description>
			<content:encoded><![CDATA[<p>在这里，我们记录一些在ESX主机上发生的、相当常见的问题。通常，可以采取一些简单的步骤去解决这些问题，但有的问题就需要较深入的解决方法。</p>
<p><strong> 紫屏死机(PSoDs， Purple Screen of Death)</strong></p>
<p>有一种在ESX和ESXi主机上都可能发生的故障，叫做紫屏死机(可以说是臭名昭著的微软蓝屏死机的VMware版)。紫屏死机会导致ESX/或ESXi主机突然崩溃、变得无法操作。紫屏死机现象如图10.6所示，你一定不希望在自己的主机上发生这种现象。</p>
<p><img src="http://images.51cto.com/files/uploadimg/20090706/1928510.jpg" alt="" width="498" height="243" /></p>
<p>图10.6 ESX主机上的紫屏死机现象</p>
<p>当PSoDs发生时，ESX会完全死机，没有任何反应。硬件问题(坏有问题的内存是最常见的原因)或ESX中的BUG是导致PSoDs的典型原因。当PSoDs发生时，你只能关闭并重启主机。屏幕上的提示信息非常有用，应该尝试记录它：可以使用带有拍照功能的手机给它照相，或者，如果存在的话，可以从一个远程管理面板上截图。你或许看不明白这些捕获下来的信息，但是，这些信息对VMware的技术支持来说非常有用。屏幕上显示的信息包括ESX的版本和build号、异常类型、寄存器转储(register dump)、崩溃时每个CPU正在跑什么、回溯追踪(back-trace)、服务器运行时间、错误日志、内存硬件信息等。</p>
<p>当你遇到PSoDs并重启主机之后，在ESX主机或/root文件夹下，会有一个以vmkernel-zdump开头(命名)的文件。这个文件对VMware技术支持非常有用，同时，你也可以使用该文件，通过vmkdump工具提取 VMkernel日志信息、寻找与PSoDs有关的线索，从而判断PSoDs发生的原因。要使用这个命令，输入vmkdump –l dump &lt;文件名&gt;。如前所述，坏有问题的内存是PSoDs中常见的原因。 你可以使用dump 文件识别引起问题的内存模块，从而将其替换掉。</p>
<p>如果怀疑是坏内存引起PSoDs，可以使用一些内存压力测试工具来检测主机的内存。这些工具需要你关闭主机并从CD启动以进行内存测试。一个常用的工具是Memtest86+，它可以进行广泛的内存测试，比如，检测邻近内存单元的相互影响，以确保要写某单元时不会覆盖邻近的单元。你可以在www.memtest.org下载这个工具。</p>
<p>当你在某个主机上首次部署ESX的时候，进行一次内存测试是个好主意，这样可以避免在以后某个时候内存故障引起麻烦。许多的内存问题都是不明显的，简单的内存测试，比如POST过程中的内存校验可能都发现不了问题。你可以下载Memtest86+测试工具，一个2MB大小的ISO文件，将这个文件刻录成CD，让主机从该CD启动，然后运行该工具至少24小时以完成多种内存测试。主机中的内存越大，完成一次测试的时间越长，一个拥有32GB内存的主机完成一次测试大概需要1天的时间。除了系统内存，Memtest86+还检测CPU的L1和L2 cache。Memtest86+的运行时间不确定，当所有的测试都完成时，通过的计数器会增加。(Memtest86+ will run indefinitely, and the pass counter will increment as all the tests are run.)</p>
<p><strong> 服务器控制台问题</strong></p>
<p>有时候，你可能会遇到服务器控制台问题，表现为：服务器控制台挂起，同时，不允许在本地登录。这种状况可能是由硬件锁定或僵尸状态引起，但是，通常这种问题不会影响在ESX主机上运行的虚拟机(VM)。重启是解决这种问题的常用方法，但是，在重启之前，你应该关闭VM，或者将VM VMmotion到其他的ESX。可以使用各种可用的途径来操作VM，完成关闭或迁移。比如，使用VI client、通过SSH登录到服务控制台或者使用可替代的/紧急的控制台(通过按Alt+F2到F6)。当VM被迁移或者关闭之后，你可以使用reboot命令重启ESX，如果所有的控制台都没有响应，你就只能去按主机上的电源按钮，冷启动主机。</p>
<p><strong> 网络问题</strong></p>
<p>有时，你也会遇到某种故障导致丢失了所有或者部分的网络配置，或者网络配置改变导致服务控制台丢失网络连接。当服务控制台的网络连接丢失时，你将无法使用远程的方法来连接ESX主机，包括VI client和SSH。你只能在本地的服务控制台上使用esxcfg-命令行工具恢复/修正网络配置，以下是一些命令，你可以从ESX CLI上使用它们配置网络：</p>
<p><strong> esxcfg-nics</strong></p>
<p>这个命令显示物理网卡列表，除去每个网卡的驱动信息、PCI设备、链接状态，你可以使用这个命令控制物理网卡的速度、双工模式等。esxcfg-nics –l显示网卡信息、esxcfg-nics –h显示该命令可用的选项，以下是一些例子：</p>
<p>o设置物理网卡vmnic2的速度和双工模式为100/Full:</p>
<p>esxcfg-nics -s 100 -d full vmnic2</p>
<p>o设置物理网卡vmnic2的速度和双工模式为自适应模式:</p>
<p>esxcfg-nics -a vmnic2</p>
<p>esxcfg-vswif</p>
<p>创建或者更新服务控制台网络，包括IP地址和端口组，esxcfg-vswif –l显示当前设置、esxcfg-vswif –h显示可用的选项，以下是一些例子：</p>
<p>o更改服务控制台(vswif0)IP地址和子网掩码:</p>
<p>esxcfg-vswif -i 172.20.20.5 -n 255.255.255.0 vswif0</p>
<p>o添加服务控制台(vswif0):</p>
<p>esxcfg-vswif -a vswif0 -p &#8220;Service Console&#8221; -i 172.20.20.40 -n 255.255.255.0</p>
<p>esxcfg-vswitch</p>
<p>创建或者更新虚拟机网络(vSwitch) ,包括上行链路、端口组和VLAN ID. 输入esxcfg-vswitch –l显示当前的vSwitch、 esxcfg-vswitch –h显示所有可用的选项. 以下是一些例子:</p>
<p>o将物理网卡(vmnic2) 添加到vSwitch (vSwitch1):</p>
<p>esxcfg-vswitch -L vmnic2 vswitch1</p>
<p>o将物理网卡(vmnic3)从一个vSwitch (vSwitch0)上移除:</p>
<p>esxcfg-vswitch -U vmnic3 vswitch0</p>
<p>o在vSwitch (vSwitch1)上添加一个端口组(VM Network3):</p>
<p>esxcfg-vswitch -A &#8220;VM Network 3&#8243; vSwitch1</p>
<p>o在vSwitch (vSwitch1)上给端口组(VM Network 3)分配一个VLAN ID(3):</p>
<p>esxcfg-vswitch -v 3 -p &#8220;VM Network 3&#8243; vSwitch1</p>
<p>esxcfg-route</p>
<p>设置或提取缺省的VMkernel网关路由。输入esxcfg-route –l当前的路由信息、esxcfg-route -h显示所有可用的选项. 以下是一些例子:</p>
<p>o设置缺省的VMkernel网关路由:</p>
<p>esxcfg-route 172.20.20.1</p>
<p>o添加一个路由到VMkernel:</p>
<p>esxcfg-route -a default 255.255.255.0 172.20.20.1</p>
<p>esxcfg-vmknic</p>
<p>为VMotion、NAS和iSCSI创建或者更新VMkernel TCP/IP设置。输入esxcfg-vmknic –l显示VMkernel NICs、esxcfg-vmknic -h显示所有可用的选项. 以下是一些例子:</p>
<p>o添加一个VMkernel NIC并设定IP和子网掩码:</p>
<p>esxcfg-vmknic -a &#8220;VM Kernel&#8221; -i 172.20.20.19 -n 255.255.255.0</p>
<p>另外，你可以通过service network restart命令重启服务控制台网络。</p>
<p><strong> 其他问题</strong></p>
<p>有时，重启某些ESX服务既可解决问题且不影响VM的运行。两个可以被重启、并可经常解决问题的服务是hostd和vpxa。运行在服务控制台中的Hostd服务负责管理ESX上的大部分操作，要重启hostd服务，登入服务控制台，输入service mgmt-vmware restart。</p>
<p>vpxa服务是管理代理，用于处理主机和客户端之间的通讯，客户端包括vCenter Server和任何连接到ESX的VI client。如果在vCenter Server上看到某个主机显示disconnected但没有显示当前信息，或者，任何其他的涉及到vCenter Server和一个主机的奇怪的问题，都可以通过重启vpxa服务来解决。要启动该服务，登入服务控制台，输入service vmware-vpxa restart。当你遇到问题时，推荐你重启这两个服务，因为，重启它们经常可以解决很多问题。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.bthome.com.cn/2010/11/13/vmware-esx-server%e5%b8%b8%e8%a7%81%e9%97%ae%e9%a2%98/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>如何提高PR输出值</title>
		<link>http://www.bthome.com.cn/2010/09/25/%e5%a6%82%e4%bd%95%e6%8f%90%e9%ab%98pr%e8%be%93%e5%87%ba%e5%80%bc/</link>
		<comments>http://www.bthome.com.cn/2010/09/25/%e5%a6%82%e4%bd%95%e6%8f%90%e9%ab%98pr%e8%be%93%e5%87%ba%e5%80%bc/#comments</comments>
		<pubDate>Sat, 25 Sep 2010 03:53:55 +0000</pubDate>
		<dc:creator>administrator</dc:creator>
				<category><![CDATA[seo]]></category>
		<category><![CDATA[pr]]></category>

		<guid isPermaLink="false">http://www.bthome.com.cn/?p=73</guid>
		<description><![CDATA[Google大受青睐的另一个原因就是它的网站索引速度。向Google提交你的网站直到为Google收录，一般只需两个星期。如果你的网站已经为Google收录，那么通常Google会每月一次遍历和更新(重新索引)你的网站信息。不过对于那些PR值(Pagerank)较高的网站，Google索引周期会相应的短一些。 Google的索引/重新索引周期比大多数搜索引擎要短。这就允许网站管理员可以对网站的页面属性进行编辑修改，如网页标题、头几行文字内容、大字标题、关键字分布，当然了还有外部链接的数量。然后他们很快就可以发现对网页所做的这些更改是否成功。 正因为Google如此受欢迎，你有必要知道Google的搜索引擎是如何工作的。如果不知道它是怎样决定你的排名，那么那些只是稍微熟悉Google排名运算法则的站点都会比你的排名位置要靠前。现在让我们来看一下Google的排名运算法则。 Google的排名运算法则主要使用了两个部分，第一个部分是它的文字内容匹配系统。Google使用该系统来发现与搜索者键入的搜索词相关的网页；第二部分也是排名运算法则中最最重要的部分，就是Google的专利网页级别技术（Pagerank?）。 我先来介绍一下如何使网站具有相关性，即文本内容匹配部分的运算法则： 在搜索网站的关键字时，Google会对其标题标签(meta title)中出现的关键字给予较高的权值。所以你应当确保在你网站的标题标签中包含了最重要的关键词，即应围绕你最重要的关键词来决定网页标题的内容。不过网页的标题不可过长，一般最好在35到40个字符之间。 众所周知，Google并不使用元标签(Meta Tags)如关键字或描述标签。这是由于在这些元标签中所使用的文字并不能为实际的访问者所看到。而且Google认为，这些元标签会被某些网站管理员用于欺诈性地放置一些与其网站毫不相干的热门关键词，并以此提高其网站对该不相干关键词的排名，从而以不正当的手段获得更多的访问者。 这种不支持Meta Tags的特性，意味着Google将从一个网页的头几行文字内容来生成对一个网站的描述。也就是说，你最好把你的关键字或关键短语放到网页的上方，这样如果Google找到它们，就会相应提高你网站的相关性。一旦Google找不到这样相关的内容，那么你要花费很大的力气来让你页面的其它部分具有相关性。 在决定一个网站的相关性时，Google也会考虑网页中正文内容的关键字密度(Keyword Density)，所以你要确保在你的整个网页中贯穿出现了若干次关键词和关键短语。但是要记住“过犹不及”，6-10%的关键词密度为最佳。 增加页面相关性的其它策略还包括：在标题内容中放入关键词，并尽可能对内容中出现的关键词进行加粗。Google现在也索引图片的ALT属性文字并计入相关性计算。所以在你的ALT属性中应包含关键词，来增加网站的相关性得分。 增加页面相关性的最后一个技巧就是使你网站上的外部文字链接包含你的关键字。在外部文字链接中包含关键字可有效提高你的网站相关性得分（Google在其PageRank技术的描述中，亦提及在计算网页级别时会对该网站的外部链接进行分析并计入相关性）。 在文字链接中应该包含多少关键字？这是个见仁见智的问题。不过我注意到有很多网站在他们的交换链接区域，已经提供了相应的文字链接内容。例如：“欢迎进行友情链接，并请使用如下代码建立至本网站的链接。” 上面我们介绍了Google如何计算网站的相关性，及如何增加网站相关性的一些有关知识。不过Google究竟使用什么方法来衡量一个网站的好坏呢？答案就是－Google的Pagerank?系统。 PageRank取自Google的创始人Larry Page，它是Google排名运算法则（排名公式）的一部分，用来标识网页的等级/重要性。级别从1到10级，10级为满分。PR值越高说明该网页越受欢迎（越重要）。例如：一个PR值为1的网站表明这个网站不太具有流行度，而PR值为7到10则表明这个网站非常受欢迎（或者说极其重要）。 在计算网站排名时，PageRank会将网站的外部链接数考虑进去。我们可以这样说：一个网站的外部链接数越多其PR值就越高；外部链接站点的级别越高（假如Macromedia的网站链到你的网站上），网站的PR值就越高。例如：如果ABC.COM网站上有一个XYZ.COM网站的链接，那么ABC.COM网站必须提供一些较好的网站内容，从而Google会把来自XYZ.COM的链接作为它对ABC.COM网站投的一票。你可以下载和安装Google的工具条来检查你的网站级别（PR值）。 那么是不是说，一个网站的外部链接数越高（获得的投票越多）， 这个网站就越重要，因而在用与其相关的关键词进行搜索时，它就会取得更高的排名呢？－－大错特错。 Google对一个网站上的外部链接数的重视程度并不意味着你因此可以不求策略地与任何网站建立连接。这是因为Google并不是简单地由计算网站的外部链接数来决定其等级。要是那样的话，所有网站管理员就只剩一件事情可做了－疯狂交换链接，尽可能获得最多的外部链接。Google是这样描述的：“Google不只是看一个网站的投票数量，或者这个网站的外部链接数量。同时，它也会对那些投票的网站进行分析。如果这些网站的PR值比较高（具有相当重要性），则其投票的网站可从中受益（亦具有重要性）。 那么，是不是说对一个网站而言，它所拥有的较高网站质量和较高PR分值的外部链接数量越多就越好呢？－也不尽然。 说它错是因为－Google的Pagerank系统不单考虑一个网站的外部链接质量，也会考虑其数量。比方说，对一个有一定PR值的网站X来说，如果你的网站Y是它的唯一一个外部链接，那么Google就相信网站X将你的网站Y视做它最好的一个外部链接，从而会给你的网站Y更多的分值。可是，如果网站X上已经有49个外部链接，那么Google就相信网站X只是将你的网站视做它第50个好的网站。因而你的外部链接站点上的外部链接数越多，你所能够得到的PR分值反而会越低，它们呈反比关系。 说它对是因为－一般情况下，一个PR分值大于等于6的外部链接站点，可显著提升你的PR分值。但如果这个外部链接站点已经有100个其它的外部链接时，那你能够得到的PR分值就几乎为零了。同样，如果一个外部链接站点的PR值仅为2，但你却是它的唯一一个外部链接，那么你所获得的PR值要远远大于那个PR值为6，外部链接数为100的网站。 这个问题现在看来好象越来越复杂了。不要紧，看看下面这个公式你就会完全理解了，只是需要一点数学知识。 首先让我们来解释一下什么是阻尼因数(damping factor)。阻尼因素就是当你投票或链接到另外一个站点时所获得的实际PR分值。阻尼因数一般是0.85。当然比起你网站的实际PR值，它就显得微不足道了。现在让我们来看看这个PR分值的计算公式： PR(A) = (1-d) + d(PR(t1)/C(t1) + &#8230; + PR(tn)/C(tn)) 其中PR(A)表示的是从一个外部链接站点t1上，依据Pagerank?系统给你的网站所增加的PR分值；PR(t1)表示该外部链接网站本身的PR分值；C(t1)则表示该外部链接站点所拥有的外部链接数量。大家要谨记：一个网站的投票权值只有该网站PR分值的0.85，而且这个0.85的权值平均分配给其链接的每个外部网站。 设想一个名为akamarketing.com的网站，被链接至PR值为4，外部链接数为9的网站XYZ.COM，则计算公式如下： PR(AKA) = (1-0.85) + 0.85*(4/10) PR(AKA) = 0.15 + 0.85*(0.4) PR(AKA) = 0.15 + 0.34 [...]]]></description>
			<content:encoded><![CDATA[<p>Google大受青睐的另一个原因就是它的网站索引速度。向Google提交你的网站直到为Google收录，一般只需两个星期。如果你的网站已经为Google收录，那么通常Google会每月一次遍历和更新(重新索引)你的网站信息。不过对于那些PR值(Pagerank)较高的网站，Google索引周期会相应的短一些。</p>
<p>Google的索引/重新索引周期比大多数搜索引擎要短。这就允许网站管理员可以对网站的页面属性进行编辑修改，如网页标题、头几行文字内容、大字标题、关键字分布，当然了还有外部链接的数量。然后他们很快就可以发现对网页所做的这些更改是否成功。</p>
<p>正因为Google如此受欢迎，你有必要知道Google的搜索引擎是如何工作的。如果不知道它是怎样决定你的排名，那么那些只是稍微熟悉Google排名运算法则的站点都会比你的排名位置要靠前。现在让我们来看一下Google的排名运算法则。</p>
<p>Google的排名运算法则主要使用了两个部分，第一个部分是它的文字内容匹配系统。Google使用该系统来发现与搜索者键入的搜索词相关的网页；第二部分也是排名运算法则中最最重要的部分，就是Google的专利网页级别技术（Pagerank?）。</p>
<p>我先来介绍一下如何使网站具有相关性，即文本内容匹配部分的运算法则：</p>
<p>在搜索网站的关键字时，Google会对其标题标签(meta title)中出现的关键字给予较高的权值。所以你应当确保在你网站的标题标签中包含了最重要的关键词，即应围绕你最重要的关键词来决定网页标题的内容。不过网页的标题不可过长，一般最好在35到40个字符之间。</p>
<p>众所周知，Google并不使用元标签(Meta Tags)如关键字或描述标签。这是由于在这些元标签中所使用的文字并不能为实际的访问者所看到。而且Google认为，这些元标签会被某些网站管理员用于欺诈性地放置一些与其网站毫不相干的热门关键词，并以此提高其网站对该不相干关键词的排名，从而以不正当的手段获得更多的访问者。</p>
<p>这种不支持Meta Tags的特性，意味着Google将从一个网页的头几行文字内容来生成对一个网站的描述。也就是说，你最好把你的关键字或关键短语放到网页的上方，这样如果Google找到它们，就会相应提高你网站的相关性。一旦Google找不到这样相关的内容，那么你要花费很大的力气来让你页面的其它部分具有相关性。</p>
<p>在决定一个网站的相关性时，Google也会考虑网页中正文内容的关键字密度(Keyword Density)，所以你要确保在你的整个网页中贯穿出现了若干次关键词和关键短语。但是要记住“过犹不及”，6-10%的关键词密度为最佳。</p>
<p>增加页面相关性的其它策略还包括：在标题内容中放入关键词，并尽可能对内容中出现的关键词进行加粗。Google现在也索引图片的ALT属性文字并计入相关性计算。所以在你的ALT属性中应包含关键词，来增加网站的相关性得分。</p>
<p>增加页面相关性的最后一个技巧就是使你网站上的外部文字链接包含你的关键字。在外部文字链接中包含关键字可有效提高你的网站相关性得分（Google在其PageRank技术的描述中，亦提及在计算网页级别时会对该网站的外部链接进行分析并计入相关性）。</p>
<p>在文字链接中应该包含多少关键字？这是个见仁见智的问题。不过我注意到有很多网站在他们的交换链接区域，已经提供了相应的文字链接内容。例如：“欢迎进行友情链接，并请使用如下代码建立至本网站的链接。”</p>
<p>上面我们介绍了Google如何计算网站的相关性，及如何增加网站相关性的一些有关知识。不过Google究竟使用什么方法来衡量一个网站的好坏呢？答案就是－Google的Pagerank?系统。</p>
<p>PageRank取自Google的创始人Larry Page，它是Google排名运算法则（排名公式）的一部分，用来标识网页的等级/重要性。级别从1到10级，10级为满分。PR值越高说明该网页越受欢迎（越重要）。例如：一个PR值为1的网站表明这个网站不太具有流行度，而PR值为7到10则表明这个网站非常受欢迎（或者说极其重要）。</p>
<p>在计算网站排名时，PageRank会将网站的外部链接数考虑进去。我们可以这样说：一个网站的外部链接数越多其PR值就越高；外部链接站点的级别越高（假如Macromedia的网站链到你的网站上），网站的PR值就越高。例如：如果ABC.COM网站上有一个XYZ.COM网站的链接，那么ABC.COM网站必须提供一些较好的网站内容，从而Google会把来自XYZ.COM的链接作为它对ABC.COM网站投的一票。你可以下载和安装Google的工具条来检查你的网站级别（PR值）。</p>
<p>那么是不是说，一个网站的外部链接数越高（获得的投票越多）， 这个网站就越重要，因而在用与其相关的关键词进行搜索时，它就会取得更高的排名呢？－－大错特错。</p>
<p>Google对一个网站上的外部链接数的重视程度并不意味着你因此可以不求策略地与任何网站建立连接。这是因为Google并不是简单地由计算网站的外部链接数来决定其等级。要是那样的话，所有网站管理员就只剩一件事情可做了－疯狂交换链接，尽可能获得最多的外部链接。Google是这样描述的：“Google不只是看一个网站的投票数量，或者这个网站的外部链接数量。同时，它也会对那些投票的网站进行分析。如果这些网站的PR值比较高（具有相当重要性），则其投票的网站可从中受益（亦具有重要性）。</p>
<p>那么，是不是说对一个网站而言，它所拥有的较高网站质量和较高PR分值的外部链接数量越多就越好呢？－也不尽然。</p>
<p>说它错是因为－Google的Pagerank系统不单考虑一个网站的外部链接质量，也会考虑其数量。比方说，对一个有一定PR值的网站X来说，如果你的网站Y是它的唯一一个外部链接，那么Google就相信网站X将你的网站Y视做它最好的一个外部链接，从而会给你的网站Y更多的分值。可是，如果网站X上已经有49个外部链接，那么Google就相信网站X只是将你的网站视做它第50个好的网站。因而你的外部链接站点上的外部链接数越多，你所能够得到的PR分值反而会越低，它们呈反比关系。</p>
<p>说它对是因为－一般情况下，一个PR分值大于等于6的外部链接站点，可显著提升你的PR分值。但如果这个外部链接站点已经有100个其它的外部链接时，那你能够得到的PR分值就几乎为零了。同样，如果一个外部链接站点的PR值仅为2，但你却是它的唯一一个外部链接，那么你所获得的PR值要远远大于那个PR值为6，外部链接数为100的网站。</p>
<p>这个问题现在看来好象越来越复杂了。不要紧，看看下面这个公式你就会完全理解了，只是需要一点数学知识。</p>
<p>首先让我们来解释一下什么是阻尼因数(damping factor)。阻尼因素就是当你投票或链接到另外一个站点时所获得的实际PR分值。阻尼因数一般是0.85。当然比起你网站的实际PR值，它就显得微不足道了。现在让我们来看看这个PR分值的计算公式：</p>
<p>PR(A) = (1-d) + d(PR(t1)/C(t1) + &#8230; + PR(tn)/C(tn))</p>
<p>其中PR(A)表示的是从一个外部链接站点t1上，依据Pagerank?系统给你的网站所增加的PR分值；PR(t1)表示该外部链接网站本身的PR分值；C(t1)则表示该外部链接站点所拥有的外部链接数量。大家要谨记：一个网站的投票权值只有该网站PR分值的0.85，而且这个0.85的权值平均分配给其链接的每个外部网站。</p>
<p>设想一个名为akamarketing.com的网站，被链接至PR值为4，外部链接数为9的网站XYZ.COM，则计算公式如下：</p>
<p>PR(AKA) = (1-0.85) + 0.85*(4/10)</p>
<p>PR(AKA) = 0.15 + 0.85*(0.4)</p>
<p>PR(AKA) = 0.15 + 0.34</p>
<p>PR(AKA) = 0.49</p>
<p>也就是说，如果我的网站获得一个PR值为4，外部链接数为9的网站的链接，最后我的网站将获得0.49的PR分值。</p>
<p>再让我们看看如果我的网站获得的是一个PR分值为8，外部链接数为16的网站的链接，那么我将获得的PR分值将是：</p>
<p>PR(AKA) = (1-0.85) + 0.85*(8/16)</p>
<p>PR(AKA) = 0.15 + 0.85(0.5)</p>
<p>PR(AKA) = 0.15 + 0.425</p>
<p>PR(AKA) = 0.575</p>
<p>上述两个例子表明，外部链接站点的PR值固然重要，该站点的外部链接数也是一个需要考虑的重要因素。</p>
<p>好了，大家无须记住上面的公式，只要记住：在建设你自己网站的外部链接时，应尽可能找那些PR值高且外部链接数又少的网站。这样一来你网站上这样的外部链接站点越多，你的PR值就会越高，从而使得你的排名得到显著提升。</p>
<p>不过，为使你的PR值得到提高，你最应该做的一件事情就是－向DMOZ提交你的网站，从而为DMOZ，即ODP（开放目录专案）收录。</p>
<p>众所周知，Google的Pagerank?系统对那些门户网络目录如DMOZ，Yahoo和Looksmart尤为器重。特别是对DMOZ。一个网站上的DMOZ链接对Google的Pagerank?来说，就好象一块金子一样有价值。这时候收录该网站的那个DMOZ目录页的PR分值，也变得无足轻重了。我就看到过有一些站点，就因为被ODP所收录，从而身价倍增，其PR分值在Google上立即得到提升。这就是因为Google使用了它自己的ODP版本作为它的网站目录。</p>
<p>ODP的链接对Pagerank?非常重要。如果你的网站为ODP收录，则可有效提升你的页面等级。不信吗？</p>
<p>确实如此。在Google上随便找个词搜索，你会发现，Google所提供的搜索结果的头10个站点中，就有7到8个也同时在Google的目录中出现。这个事实足以说明，如果一个网站没有被ODP收录的话，那它也别指望能从Google上得到太多的访问量。</p>
<p>向ODP提交你的站点并为它收录，其实并不是一件难事，只是要多花点时间而已。只要确保你的网站提供了良好的内容，然后在ODP合适的目录下点击“增加站点”，按照提示一步步来就OK了。至少要保证你的索引页(INDEX PAGE)被收录进去。我说“至少”是因为尽管ODP声称他们只收录你的索引页，而事实上在ODP上却不乏被收录了5到10页的网站。所以，如果你的网站内容涉及完全不同的几块内容，你可以把每个内容的网页分别向ODP提交－不过请记住“欲速则不达”。等到Google对其目录更新后，你就能看到你的PR值会有什么变化了。</p>
<p>如果你的网站为Yahoo和Looksmart所收录，那么你的PR值会得到显著提升。关于“Yahoo提交技巧”，如果有时间可以阅读下面这篇文章“Yahoo网站提交技巧”。</p>
<p>如果你的网站是非商业性质的或几乎完全是非商业性质的内容，那么你可以通<a href="http://wenwen.soso.com/z/UrlAlertPage.e?sp=Swww.Zeal.com" target="_blank">www.Zeal.com</a>使你的网站为著名的网络目录Looksmart所收录。我个人非常喜爱ZEAL.COM，就象Google也从DMOZ获得搜索结果一样，Looksmart也是从Zeal网络目录获得非商业搜索列表。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.bthome.com.cn/2010/09/25/%e5%a6%82%e4%bd%95%e6%8f%90%e9%ab%98pr%e8%be%93%e5%87%ba%e5%80%bc/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>如何利用网站赚钱(英文原版)</title>
		<link>http://www.bthome.com.cn/2010/09/15/%e5%a6%82%e4%bd%95%e5%88%a9%e7%94%a8%e7%bd%91%e7%ab%99%e8%b5%9a%e9%92%b1%e8%8b%b1%e6%96%87%e5%8e%9f%e7%89%88/</link>
		<comments>http://www.bthome.com.cn/2010/09/15/%e5%a6%82%e4%bd%95%e5%88%a9%e7%94%a8%e7%bd%91%e7%ab%99%e8%b5%9a%e9%92%b1%e8%8b%b1%e6%96%87%e5%8e%9f%e7%89%88/#comments</comments>
		<pubDate>Wed, 15 Sep 2010 03:53:32 +0000</pubDate>
		<dc:creator>administrator</dc:creator>
				<category><![CDATA[网站建设]]></category>
		<category><![CDATA[广告]]></category>
		<category><![CDATA[网赚]]></category>
		<category><![CDATA[英文版]]></category>

		<guid isPermaLink="false">http://www.bthome.com.cn/?p=66</guid>
		<description><![CDATA[There are several lists with “ways to make money with a website” on the Internet, but none of them seem to be complete. That is why I decided to create this one. If you know a method that is not listed below, just let us know and we’ll update it. Notice that ways to make [...]]]></description>
			<content:encoded><![CDATA[<p>There are several lists with “ways to make money with a website” on the Internet, but none of them seem to be complete. That is why I decided to create this one. If you know a method that is not listed below, just let us know and we’ll update it.</p>
<p>Notice that ways to make money with a website are different from ways to make<em>more</em> money from it. Methods to increase your traffic or click-through rate will help you make more money, but they do not represent a method of making money per se.</p>
<p>For example, one could suggest that blending AdSense ads with the content is a way to make money from a website. In reality it’s not; it’s just a way to make more money by improving your ad click-through rate. The real monetization method behind it is a PPC ad network.</p>
<p>The list is divided into direct and indirect methods, and examples and links are provided for each point. Enjoy!</p>
<p><span id="more-66"></span></p>
<h4>Direct Methods</h4>
<p>1. <strong>PPC Advertising Networks</strong></p>
<p>Google AdSense is the most popular option under this category, but there are also others. Basically you need to sign up with the network and paste some code snippets on your website. The network will then serve contextual ads (either text or images) relevant to your website, and you will earn a certain amount of money for every click.</p>
<p>The profitability of PPC advertising depends on the general traffic levels of the website and, most importantly, on the click-through rate (CTR) and cost per click (CPC). The CTR depends on the design of the website. Ads placed abode the fold or blended with content, for instance, tend to get higher CTRs. The CPC, on the other hand, depends on the nice of the website. Mortgages, financial products and college education are examples of profitable niches (clicks worth a couple of dollars are not rare), while tech-related topics tend to receive a smaller CPC (sometimes as low as a couple of cents per click).</p>
<p>The source of the traffic can also affect the overall CTR rate. Organic traffic (the one that comes from search engines) tends to perform well because these visitors were already looking for something, and they tend to click on ads more often. Social media traffic, on the other hand, presents terribly low CTRs because these visitors are tech-savvy and they just ignore ads.</p>
<p>List of popular CPC advertising networks:</p>
<ul>
<li><a rel="nofollow" href="http://www.google.com/adsense">Google Adsense</a></li>
<li><a rel="nofollow" href="http://publisher.yahoo.com/">Yahoo! Publisher Network (YPN)</a></li>
<li><a rel="nofollow" href="http://www.bidvertiser.com/">BidVertiser</a></li>
<li><a rel="nofollow" href="http://chitika.com/">Chitika</a></li>
<li><a rel="nofollow" href="http://www.clicksor.com/">Clicksor</a></li>
</ul>
<p>2. <strong>CPM Advertising Networks</strong></p>
<p>CPM advertising networks behave pretty much as PPC networks, except that you get paid according to the number of impressions (i.e., page views) that the ads displayed on your site will generate. CPM stands for <em>Cost per Mille</em>, and it refers to the cost for 1,000 impressions.</p>
<p>A blog that generates 100,000 page views monthly displaying an advertising banner with a $1 CPM, therefore, will earn $100 monthly.</p>
<p>CPM rates vary with the network, the position of the ad and the format. The better the network, the higher the CPM rate (because they have access to more advertisers). The closer you put the ad to the top of the page, the higher the CPM. The bigger the format (in terms of pixels), the higher the CPM.</p>
<p>You can get as low as $0,10 and as high as $10 per 1,000 impressions (more in some special cases). CPM advertising tends to work well on websites with a high page views per visitor ratio (e.g., online forums, magazines and so on).</p>
<p>List of popular CPM advertising networks:</p>
<ul>
<li><a rel="nofollow" href="http://casalemedia.com/">Casale Media</a></li>
<li><a rel="nofollow" href="http://www.burstmedia.com/">Burst Media</a></li>
<li><a rel="nofollow" href="http://www.valueclickmedia.com/">Value Click</a></li>
<li><a rel="nofollow" href="http://www.advertising.com/index.php">Advertising.com</a></li>
<li><a rel="nofollow" href="http://www.tribalfusion.com/SmartPublishers/">Tribal Fusion</a></li>
<li><a rel="nofollow" href="http://www.rightmedia.com/">Right Media</a></li>
</ul>
<p>3. <strong>Direct Banner Advertising</strong></p>
<p>Selling your own advertising space is one of the most lucrative monetization methods. First and foremost because it enables you to cut out the middleman commissions and to determine your own rates. The most popular banner formats on the web are the 728×90 leaderboard, the 120×600 skyscraper, the 300×250 rectangle and the 125×125 button.</p>
<p>The downside of direct banner advertising is that you need to have a big audience to get qualified advertisers, and you will need to spend time managing the sales process, the banners and the payments.</p>
<p>Related links:</p>
<ul>
<li><a rel="nofollow" href="http://www.dailyblogtips.com/how-to-find-advertisers-for-your-website-the-ultimate-guide/">How to Find Advertisers for Your Website</a></li>
<li><a href="http://www.problogger.net/archives/2007/04/11/finding-advertisers-for-your-blog/">Finding Advertisers for Your Blog</a></li>
<li><a href="http://www.doshdosh.com/direct-advertising-sales-beginners-monetization-strategies/">Direct Advertising Sales for Beginners</a></li>
<li><a rel="nofollow" href="http://www.openads.org/">Openads Ad Server</a></li>
<li><a rel="nofollow" href="http://www.oiopublisher.com/">OIO Publisher Ad Platform</a></li>
</ul>
<p>4. <strong>Text Link Ads</strong></p>
<p>After Google declared that sites selling text links without the nofollow tag would be penalized, this monetization method became less popular.</p>
<p>Many website owners are still using text links to monetize their sites, though, some using the nofollow tag and some not.</p>
<p>The advantage of this method is that it is not intrusive. One can sell text links directly through his website or use specialized networks like Text-Link-Ads and Text-Link-Brokers to automate the process.</p>
<p>Text link marketplaces and networks:</p>
<ul>
<li><a rel="nofollow" href="http://forums.digitalpoint.com/forumdisplay.php?f=58">DigitalPoint Link Sales Forum</a></li>
<li><a rel="nofollow" href="http://www.text-link-ads.com/">Text-Link-Ads</a></li>
<li><a rel="nofollow" href="http://www.textlinkbrokers.com/">Text-Link-Brokers</a></li>
<li><a rel="nofollow" href="http://www.tnx.net/">TNX</a></li>
<li><a rel="nofollow" href="http://www.linkworth.com/">LinkWorth</a></li>
</ul>
<p>5. <strong>Affiliate Marketing</strong></p>
<p>Affiliate marketing is a very popular practice on the Internet. Under this system you have a merchant that is willing to let other people (the affiliates) sell directly or indirectly its products and services, in exchange for a commission. Sometimes this type of advertising is also called CPA (cost per action) or CPL (cost per lead) based.</p>
<p>Affiliates can send potential customers to the merchant using several tools, from banners to text links and product reviews.</p>
<p>In order to find suitable affiliate programs you can turn to individual companies and publishers like <a rel="nofollow" href="http://www.dreamhost.com/">Dreamhost</a> and <a href="http://www.seobook.com/">SEOBook</a>, or join affiliate marketplaces and networks.</p>
<p>List of popular affiliate marketplaces and networks:</p>
<ul>
<li><a rel="nofollow" href="http://www.cj.com/">Commission Junction</a></li>
<li><a rel="nofollow" href="http://www.clickbank.com/index.html">ClickBank</a></li>
<li><a rel="nofollow" href="https://www.azoogleads.com/corp/index.php">Azoogle Ads</a></li>
<li><a rel="nofollow" href="http://www.linkshare.com/index.shtml">Link Share</a></li>
</ul>
<p>6. <strong>Monetization Widgets</strong></p>
<p>The latest trend on the web are widgets that let you monetize your website. Examples include Widgetbucks and SmartLinks. Some of these services operate under a PPC scheme, others behave like text link ads, others yet leverage affiliate links.</p>
<p>Their main differentiator, however, is the fact that they work as web widgets, making it easier for the user to plug and play the service on its website.</p>
<p>List of companies that provide monetization widgets:</p>
<ul>
<li><a rel="nofollow" href="http://www.widgetbucks.com/">WidgetBucks</a></li>
<li><a rel="nofollow" href="http://www.scratchback.com/">ScratchBack</a></li>
<li><a rel="nofollow" href="http://www.adaptiveblue.com/smartlinks.html">SmartLinks</a></li>
</ul>
<p>7. <strong>Sponsored Reviews</strong></p>
<p>PayPerPost pioneered this model, with much controversy on the beginning (related to the fact that they did not require disclosure on paid posts). Soon other companies followed, most notably Sponsored Reviews and ReviewMe, refining the process and expanding the paid blogging model.</p>
<p>Joining one of these sponsored reviews marketplaces will give you the opportunity to write sponsored posts on a wide range of topics. Not all bloggers are willing to get paid to write about a specific product or website (because it might compromise the editorial credibility), but the ones who do are making good money out of it.</p>
<p>If your blog has a big audience you could also offer sponsored reviews directly, cutting off the commissions of the middleman.</p>
<p>List of sponsored reviews and paid blogging networks:</p>
<ul>
<li><a rel="nofollow" href="http://payperpost.com/">PayPerPost</a></li>
<li><a rel="nofollow" href="http://www.sponsoredreviews.com/">Sponsored Reviews</a></li>
<li><a rel="nofollow" href="http://www.reviewme.com/">ReviewMe</a></li>
<li><a rel="nofollow" href="http://www.blogsvertise.com/">BlogVertise</a></li>
<li><a rel="nofollow" href="http://www.smorty.com/">Smorty</a></li>
</ul>
<p>8. <strong>RSS Feed Ads</strong></p>
<p>With the quick adoption of the RSS technology by millions of Internet users, website owners are starting to find ways to monetize this new content distribution channel.</p>
<p>Feedburber already has its own publisher network, and you can sign-up to start displaying CPM based advertising on your feed footer. Bidvertiser recently introduced a RSS feed ad option as well, with a PPC scheme.</p>
<p>Finally, some blogs are also opting to sell banners or sponsored messages on their feed directly. <a rel="nofollow" href="http://www.johnchow.com/">John Chow</a> and <a rel="nofollow" href="http://www.marketingpilgrim.com/">Marketing Pilgrim</a> are two examples.</p>
<p>Related links:</p>
<ul>
<li><a rel="nofollow" href="http://www.feedburner.com/fb/a/home">Feedburner</a></li>
<li><a rel="nofollow" href="http://www.bidvertiser.com/">BidVertiser</a></li>
<li><a rel="nofollow" href="http://www.pheedo.com/">Pheedo</a></li>
</ul>
<p>9. <strong>Sponsors for Single Columns or Events</strong></p>
<p>If you website has specific columns or events (e.g., a weekly podcast, an interview series, a monthly survey, a special project) you could find companies to sponsor them individually.</p>
<p>This method increases the monetization options for website owner, while giving advertisers the possibility to target a more specific audience and with a reduced commitment.</p>
<p><a href="http://mashable.com/advertise">Mashable</a> illustrates the case well. They have several advertising options on the site, including the possibility to sponsor specific columns and articles, including the “Daily Poll” and the “Web 2.0 Invites.”</p>
<p><a href="http://problogger.net/">Problogger</a> also runs group writing projects occasionally, and before proceeding he publicly announce the project asking for sponsors.</p>
<p>10.<strong>Premium Content</strong></p>
<p>Some websites and blogs give away part of their content for free, and charge for access to the premium content and exclusive tools.</p>
<p><a href="http://www.seomoz.org/">SEOMoz</a> is a good example. They have a very popular blog that gives advice and information on wide range of SEO related topics. On top of that visitors can decide to become premium members. It costs $48 monthly and it grants them access to guides, tools and other exclusive material.</p>
<p>11. <strong>Private Forums</strong></p>
<p>While the Internet is populated with free forums, there is also the possibility to create a private one where members need to pay a single or recurring fee to join.<br />
<a href="http://seoblackhat.com/2006/08/14/seo-blackhat-forum/"><br />
SEO Blackhat</a> charges $100 monthly from its members, and they have thousands of them. Obviously in order to charge such a price for a forum membership you need to provide real value for the members (e.g., secret techniques, tools, and so on).</p>
<p><a href="http://performancing.com/">Performancing</a> also launched a private forum recently, focused on the networking aspect. It is called The Hive, and the monthly cost is $10.</p>
<p>These are just two examples. There are many possibilities to create a private and profitable forum, you just need to find an appealing angle that will make it worth for the members.</p>
<p>List of popular forum software:</p>
<ul>
<li><a rel="nofollow" href="http://www.vbulletin.com/">vBulletin</a></li>
<li><a rel="nofollow" href="http://www.simplemachines.org/">Simple Machines Forum</a></li>
<li><a rel="nofollow" href="http://www.phpbb.com/">phpBB</a></li>
<li><a rel="nofollow" href="http://www.getvanilla.com/">Vanilla</a></li>
</ul>
<p>12. <strong>Job Boards</strong></p>
<p>All the popular blogs are trying to leverage job boards to make some extra income.<a href="http://jobs.guykawasaki.com/a/jbb/find-jobs">Guy Kawasaki</a>, <a href="http://jobs.readwriteweb.com/">ReadWriteWeb</a>, <a href="http://jobs.problogger.net/">Problogger</a>… you name it.</p>
<p>Needless to say that in order to create an active and profitable job board you need first to have a blog focused on a specific niche, and a decent amount traffic.</p>
<p>The advantage of this method is that it is passive. Once you have the structure in place, the job listings will come naturally, and you can charge anywhere from $10 up to $100 for each.</p>
<p>List of popular job board software:</p>
<ul>
<li><a rel="nofollow" href="http://www.jobthread.com/">JobThread</a></li>
<li><a rel="nofollow" href="http://www.webscribble.com/products/webjobs/">Web Scribe Job Board</a></li>
<li><a rel="nofollow" href="http://www.simplyhired.com/a/publishers/overview">SimplyHired Job-o-matic</a></li>
<li><a rel="nofollow" href="http://www.jobbex.com/">Jobbex</a></li>
</ul>
<p>13. <strong>Marketplaces</strong></p>
<p><a href="http://www.sitepoint.com/marketplace/">Sitepoint</a> is the online marketplace by excellence. Some websites and blogs, however, are trying to replicate that model on a smaller scale.</p>
<p>Depending on your niche, a market place that allows your visitors to buy, sell and trade products could work well. Over the time you could start charging a small fee for new product listings.</p>
<p>The problem with this method is that there are no standard software on the web, so you would need to hire a coder to get a marketplace integrated into your website.</p>
<p>You can see an example of a marketplaces being used on <a href="http://marketplace.easywordpress.com/">EasyWordpress</a> and on<a href="http://market.mashable.com/">Mashable</a>.</p>
<p>14. <strong>Paid Surveys and Polls</strong></p>
<p>There are services that will pay you money to run a small survey or poll on your website. The most popular one is called <a rel="nofollow" href="http://answers.vizu.com/solutions/power-polls/index.htm">Vizu Answers</a>.</p>
<p>Basically you need to sign up with them, and select the kind of polls that you want to run your site. Most of these services operate under a CPM model.</p>
<p>15. <strong>Selling or Renting Internal Pages</strong></p>
<p><a href="http://www.milliondollarwiki.com/Main_Page">Million Dollar Wiki</a> made this concept popular, but it was being used on the web for a long time around (check <a href="http://pagerank10.co.uk/">Pagerank10.co.uk</a> for instance).</p>
<p>These websites sell for a single fee or rent for a recurring fee internal pages on their domain. Usually they have either high Pagerak or high traffic, so that people purchasing a page will be able to benefit in some way.</p>
<p>Implementing this method on a small blog would be difficult, but the concept is interesting and could be explored further.</p>
<p>16. <strong>Highlighted Posts from Sponsors</strong></p>
<p><a href="http://www.techmeme.com/">Techmeme</a> probably pioneered this idea, but somehow it has not spread to other websites. The tech news aggregator displays editorial posts on the left column, and on the sidebar they have a section titled “Techmeme Sponsor Posts.”</p>
<p>On that section posts from the blog of the advertisers get highlighted, sending qualified traffic their way. Considering that the monthly cost for one spot is $5000 and that they have around 6 sponsors at any given time, it must be working well.</p>
<p>17. <strong>Donations</strong></p>
<p>Placing a “Donate” link or button on a website can be an efficient way to earn money, especially if your blog is on a niche where readers learn and gain value from your content.</p>
<p>Personal development and productivity blogs, for instance, tend to perform well with donation based systems (one good example being <a href="http://www.stevepavlina.com/donate.htm">Steve Pavlina</a>).</p>
<p>A small variation of this method appeared sometime ago with the <a href="http://www.blogclout.com/blog/goodies/buy-me-a-beer-paypal-donation-plugin/">Buy Me a Beer</a>plugin. This WordPress plugin enables you to insert a customized message at the bottom of each article, asking the readers to chip in for a beer or coffee.</p>
<p>18. <strong>In-text Adverting</strong></p>
<p>In-text adverting networks like <a rel="nofollow" href="http://www.kontera.com/">Kontera</a> and <a rel="nofollow" href="http://www.vibrantmedia.com/webpublishers/index.asp">Vibrant Media</a> will place sponsored links inside your text. These links come with a double underline to differentiate them from normal links, and once the user rolls the mouse over the link the advertising will pop. Should the user click on it the site owner will make some money.</p>
<p>Some people make good money with this method, but others refrain from using it due to its intrusiveness. It is also interesting to note that very few mainstream websites have experimented with in-text advertising.</p>
<p>19. <strong>Pop-ups and Pop-unders</strong></p>
<p>Pop-ups are a common yet annoying form of advertising on the Internet. If you are just trying to make a much money as possible from your website, you could experiment with them.</p>
<p>If you are trying to grow the traffic and generate loyal visitors, however, you probably should stay away from them. Just consider the hundreds of pop-up blockers out there: there is a reason why they are so popular.</p>
<p>Ad networks that use pop-ups:</p>
<ul>
<li><a rel="nofollow" href="http://www.tribalfusion.com/">Tribal Fusion</a></li>
<li><a rel="nofollow" href="http://paypopup.com/">PayPopup</a></li>
<li><a rel="nofollow" href="http://www.popupad.net/publishers/index.shtml">PopupAd</a></li>
<li><a rel="nofollow" href="http://www.adversal.com/faq.jsp">Adversal</a></li>
</ul>
<p>20. <strong>Audio Ads</strong></p>
<p>Also called PPP (Pay Per Play), this advertising method was introduce by <a rel="nofollow" href="http://www.netaudioads.com/">Net Audio Ads</a>. the concept is pretty simple: play a small audio advertising (usually 5 seconds) every time a visitor enters into your website. The user should not be able to stop it, creating a 100% conversion rate based on unique visitors.</p>
<p>The company is still rolling tests, but some users are reporting to get from a $4 to a $6 CPM. Regardless of the pay rate, though, this is a very intrusive form of advertising, so think twice before using it.</p>
<p>21. <strong>Selling the Website</strong></p>
<p>Selling your website could be your last resource, but it has the potential to generate a big sum of money in a short period of time.</p>
<p>Market places on online forums like <a rel="nofollow" href="http://forums.digitalpoint.com/forumdisplay.php?f=52">DigitalPoint</a> and <a rel="nofollow" href="http://www.sitepoint.com/marketplace/">Sitepoint</a> are always active with website buyers and sellers. Keep in mind that they most used parameter to determine the value of a website is the monthly revenue that it generates, multiplied by a certain number (the multiplier can be anything from 5 to 30, depending on the expectations of the seller, on the quality of the site, on the niche and other factors).</p>
<p>Some people also make money trading and flipping websites. They either create them from scratch or buy existing ones, and after some revamping they sell them for a profit.</p>
<p>Related links:</p>
<ul>
<li><a href="http://www.entrepreneurs-journey.com/274/how-to-buy-a-website-and-flip-it-for-profit/">How To Buy A Website And Flip It For Profit</a></li>
<li><a href="http://www.entrepreneurs-journey.com/265/how-to-sell-a-website-how-much-is-your-website-worth/">How To Sell A Website – How Much Is Your Website Worth?</a></li>
<li><a href="http://www.webmasterworld.com/forum25/3062.htm">Where to sell a website? How to go about selling it?</a></li>
</ul>
<h4>Indirect Methods</h4>
<p>22. <strong>Selling an Ebook</strong></p>
<p>Perhaps one of the oldest money making strategies on the web, using a website to promote a related ebook is a very efficient way to generate revenue.</p>
<p>You could either structure the website around the book itself, like <a href="http://www.seobook.com/">SEOBook.com</a>, or launch the ebook based on the success of the website, like FreelanceSwitch did we the book <a href="http://freelanceswitch.com/book">How to be a Rockstar Freelancer</a>.</p>
<p>Related links:</p>
<ul>
<li><a href="http://northxeast.com/marketing/writing-an-ebook-for-your-blog/">Writing an ebook for your blog</a></li>
<li><a rel="nofollow" href="http://www.ebookapprentice.com/sell/index.html">How to sell ebooks</a></li>
<li><a rel="nofollow" href="http://www.internetbasedmoms.com/ideas/sell-ebook.html">Processing payments for your ebook</a></li>
<li><a rel="nofollow" href="http://onlinebusiness.about.com/od/startingup/a/digital.htm">How to sell digital products online</a></li>
<li><a rel="nofollow" href="http://www.programurl.com/software/sell-ebook.htm">List of ebook selling software</a></li>
</ul>
<p>23. <strong>Selling a Hardcover Book</strong></p>
<p>Many authors and journalists leverage their blogs or websites to sell copies of hardcover books. Examples include <a href="http://blog.guykawasaki.com/">Guy Kawasaki</a>, <a href="http://sethgodin.typepad.com/">Seth Godin</a> and <a href="http://gladwell.typepad.com/gladwellcom/">Malcolm Gladwell</a>.</p>
<p>While most of these people were already renowned authors before they created their website, one could also follow the other way around. Lorelle VanFossen did exactly that with her <a href="http://lorelle.wordpress.com/books/blogging-tips/">Blogging Tips</a> book. First she built her authority on the subject via her blog, and afterwards she published the book.</p>
<p>List of self publishing and publishing services:</p>
<ul>
<li><a rel="nofollow" href="http://www.lulu.com/">Lulu</a></li>
<li><a rel="nofollow" href="http://www.selfpublishing.com/">Self Publishing</a></li>
<li><a rel="nofollow" href="http://www.iuniverse.com/">iUniverse</a></li>
<li><a rel="nofollow" href="http://www.wordclay.com/">WordClay</a></li>
</ul>
<p>24. <strong>Selling Templates or WordPress Themes</strong></p>
<p>As more and more people decide to get an online presence, website templates and WordPress themes become hotter and hotter.</p>
<p>On this segment you have mainstream websites like <a href="http://www.templatemonster.com/">TemplateMonster</a>, as well as individual designers who decide to promote and sell their work independently.</p>
<p><a href="http://www.briangardner.com/themes">Brian Gardner</a> and <a href="http://www.uniqueblogdesigns.com/ExclusiveThemes/Default.aspx">Unique Blog Designs</a> are two examples of websites that make money with the sales of premium and custom WordPress themes.</p>
<p>25. <strong>Offering Consulting and Related Services</strong></p>
<p>Depending on your niche, you could make money by offering consulting and related services. If you are also the author of your blog, the articles and information that you will share will build your profile and possibly certify your expertise on that niche, making it easier to gain customers.</p>
<p><a href="http://www.chrisg.com/">Chris Garrett</a> used a similar strategy. First he created a highly influential blog on the blogging and new media niche, and afterwards he started offering consulting services to clients with related problems and needs.</p>
<p>26. <strong>Creating an Email List or Newsletter</strong></p>
<p>Email lists and newsletters represent one of the most powerful marketing and money making tools on the Internet. They offer incredible conversion rates, and the possibility to call people to action in a very efficient way.</p>
<p>Creating a big list is a difficult task though, so if you have a popular website you could leverage it to increase the number of subscribers on your list.</p>
<p><a href="http://www.entrepreneurs-journey.com/">Yaro Starak</a> is a famous Internet marketer, and if you visit his blog you will notice that right on top he has a section encouraging visitors to subscribe to his email newsletter. Yaro generates five figures in revenues each month from his email newsletters, proving that this method works.</p>
<p>List of software to manage email newsletters:</p>
<ul>
<li><a rel="nofollow" href="http://www.aweber.com/">AWeber</a></li>
<li><a rel="nofollow" href="http://www.interspire.com/sendstudio/">SendStudio NX</a></li>
<li><a rel="nofollow" href="http://www.phpautoresponder.com/">PHP Autoresponder</a></li>
<li><a rel="nofollow" href="http://cjaffiliate.roving.com/">Constant Contact</a></li>
</ul>
<p>27. <strong>Mentoring programs</strong></p>
<p>People are willing to pay for someone or something that will teach them and give them knowledge (as opposed to mere information). Education is one of the biggest industries in the world, and the online landscape behaves in a similar way.</p>
<p>Creating a mentoring program related to the niche of your website could be very profitable if you manage to structure and promote it adequately. There is a wide range of media and tools that you can use to deliver the information, from text articles to audio and video lessons.</p>
<p>Brian Clark leveraged the success of <a href="http://www.copyblogger.com/">Copyblogger</a> to launch a mentoring program teaching people how to build membership and how to sell content online. The program is titled <a href="http://teachingsells.com/">Teaching Sells</a>, and it costs $97 monthly. Sounds expensive, but they have over 1,000 members.</p>
<p>28. <strong>Creating a conference around the website</strong></p>
<p>If your website takes off and becomes an authority on its niche, you could create a conference around it. Depending on the size of your audience, the event could attract thousands of people, and you could make money directly from conference passes and sponsors.</p>
<p><a href="http://searchengineland.com/">Search Engine Land</a>, for instance, created a series of conferences that visit several cities on the United States and on other countries as well. The conferences are called <a href="http://searchmarketingexpo.com/">Search Marketing Expo</a>, and the tickets and passes cost thousands of dollars.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.bthome.com.cn/2010/09/15/%e5%a6%82%e4%bd%95%e5%88%a9%e7%94%a8%e7%bd%91%e7%ab%99%e8%b5%9a%e9%92%b1%e8%8b%b1%e6%96%87%e5%8e%9f%e7%89%88/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>如何利用网站赚钱</title>
		<link>http://www.bthome.com.cn/2010/09/15/%e5%a6%82%e4%bd%95%e5%88%a9%e7%94%a8%e7%bd%91%e7%ab%99%e8%b5%9a%e9%92%b1/</link>
		<comments>http://www.bthome.com.cn/2010/09/15/%e5%a6%82%e4%bd%95%e5%88%a9%e7%94%a8%e7%bd%91%e7%ab%99%e8%b5%9a%e9%92%b1/#comments</comments>
		<pubDate>Wed, 15 Sep 2010 03:52:14 +0000</pubDate>
		<dc:creator>administrator</dc:creator>
				<category><![CDATA[网站建设]]></category>
		<category><![CDATA[广告]]></category>
		<category><![CDATA[网赚]]></category>

		<guid isPermaLink="false">http://www.bthome.com.cn/?p=64</guid>
		<description><![CDATA[很多地方都谈到了网站的赚钱方式，不过下面这个应该是最全的了。如果你觉得还有遗漏，可以在下面补充哦。 需要注意的是，这里说的是网站的赚钱方式，而不是赚更多钱的方式。增加流量、提高点击率等，都能让你锦上添花，但它们本身并不代表一种赚钱方式。例如， 将AdSense广告整合到网站文章里可以为网站盈利。但事实上这不是一种赚钱方式，只是通过提高广告点击率赚钱的表现形式之一，其现实盈利方式是PPC和网络。 下面介绍的方法分为直接和间接两种方式，一起来研究吧。 直接方式 1. PPC广告 Google AdSense是PPC（PAY PER CLICK）的最佳选择，但实际上很多广告联盟都提供PPC广告。如果希望通过这种方式赚钱，首先你需要注册一个账号，然后在自己网站里加入若干代码。之后这个广告联盟会根据你的网站内容提供相关广告（可能是文字广告，也可能是图片广告）， 最后，如果有人点击了这些广告，你就可以根据点击次数得到一定的广告费了。 PPC广告收益取决于网站的总体流量，广告点击率（CTR）以及平均点击价格（CPC）。CTR取决于网站的版面设计，例如浮动式广告和文章中的广告点击率相对较高。CPC则取决于网站的行业属性，房产抵押、金融产品以及学校教育类网站的平均点击价格普遍高于技术类网站。 当然，网站流量也是影响CTR的因素之一。来自搜索引擎的自然流量点击广告的可能性更大，因为访客本身就是为寻找某种信息而来。而来自社交媒体的流量则很少点击广告，他们通常会忽略广告的存在。 2. CPM广告联盟 CPM广告网络的形式与PPC广告网络非常相似，唯一不同在于，CPM广告联盟是通过用户网站上广告的印象数（如页面浏览量）来给用户付费。CPM的全称是Cost per Mile，即每千人成本。 如果一个博客的广告横幅每月有10万次页面浏览量，CPM价格为1美元，那么这个博客的主人每月的广告收入就是100美元。 广告联盟、广告投放位置以及广告样式都会影响到CPM价格。广告联盟越好，吸引的广告投放商越多，CPM价格就越高。广告距离页面最上方越近，CPM价格也就越高。广告尺寸越大（以像素为单位），CPM价格越高。 CPM有时只有0.1美元，有时又可高达10美元。 对人均访客页面点击率较高的网站来说，CPM广告是个不错的选择。 3. 直接出售旗帜广告 直接出售网站上的广告位也是一种赚钱方式。首先这种方式避免了支付给中间商的必需费用，其次你可以自己决定广告费用。最常见的旗帜广告是728×90横幅广告、120×600竖幅广告、300×250方形广告以及125×125按钮广告。 直接出售旗帜广告不好的地方是，如果你的读者群不够庞大，广告商就不会在你的网站上投放广告。此外你还需要花时间来销售自己的广告位、商谈支付事宜等。 4. 文字链接广告 自Google宣布会对出售不带nofollow标签的文字广告的行为进行处罚后，这种赚钱方式开始逐渐衰落。 尽管如此，很多站长仍然没有停止使用文字广告，其中有些使用nofollow标签，有些仍然没有使用。 文字广告的好处是不会对访客造成困扰。站长们可以直接出售文字广告，也可以通过Text-Link-Ads 以及Text-Link-Brokers等专业联盟。 5. 广告联盟推广 加入某个广告联盟也是一种常见的互联网推广方式。你可以选择一家服务提供商并申请成为会员，然后在自己的网站上直接或间接出售这家提供商的产品或服务，从而获取一定佣金。这种方式也可以叫做CPA（Cost per Action）或CPL（Cost per Lead）。 你可以寻找个人公司进行合作，也可以加入各种已有的联盟。 6. 赚钱工具 通过Widgetbucks、SmartLinks等赚钱工具来盈利是一种最新的网赚趋势。这种方式可基于PPC，也可以基于文本链接广告或联盟链接。 但赚钱工具和它们的最大差别是，赚钱工具以“网络工具”形式存在，更方便用户放置，也更容易发挥作用。 7. 付费评论 这是一种相对受争议的赚钱方式。不是所有站长都愿意为某种产品或某个网站做付费评论。 不过这的确是种回报较高的网赚方式。 8. RSS 订阅广告 互联网上存在着数百万使用RSS订阅的用户，这就决定了RSS订阅也将成为网赚商机。 你可以注册那些支持显示footer广告的订阅服务提供商，也可以出售自己RSS订阅的广告位。 9. [...]]]></description>
			<content:encoded><![CDATA[<p>很多地方都谈到了网站的赚钱方式，不过下面这个应该是最全的了。如果你觉得还有遗漏，可以在下面补充哦。</p>
<p>需要注意的是，这里说的是网站的赚钱方式，而不是赚更多钱的方式。增加流量、提高点击率等，都能让你锦上添花，但它们本身并不代表一种赚钱方式。例如， 将AdSense广告整合到网站文章里可以为网站盈利。但事实上这不是一种赚钱方式，只是通过提高广告点击率赚钱的表现形式之一，其现实盈利方式是PPC和网络。</p>
<p>下面介绍的方法分为直接和间接两种方式，一起来研究吧。</p>
<p><span id="more-64"></span></p>
<p>直接方式</p>
<h3>1. PPC广告</h3>
<p>Google AdSense是PPC（PAY PER CLICK）的最佳选择，但实际上很多广告联盟都提供PPC广告。如果希望通过这种方式赚钱，首先你需要注册一个账号，然后在自己网站里加入若干代码。之后这个广告联盟会根据你的网站内容提供相关广告（可能是文字广告，也可能是图片广告）， 最后，如果有人点击了这些广告，你就可以根据点击次数得到一定的广告费了。</p>
<p>PPC广告收益取决于网站的总体流量，广告点击率（CTR）以及平均点击价格（CPC）。CTR取决于网站的版面设计，例如浮动式广告和文章中的广告点击率相对较高。CPC则取决于网站的行业属性，房产抵押、金融产品以及学校教育类网站的平均点击价格普遍高于技术类网站。</p>
<p>当然，网站流量也是影响CTR的因素之一。来自搜索引擎的自然流量点击广告的可能性更大，因为访客本身就是为寻找某种信息而来。而来自社交媒体的流量则很少点击广告，他们通常会忽略广告的存在。</p>
<h3>2. CPM广告联盟</h3>
<p>CPM广告网络的形式与PPC广告网络非常相似，唯一不同在于，CPM广告联盟是通过用户网站上广告的印象数（如页面浏览量）来给用户付费。CPM的全称是Cost per Mile，即每千人成本。</p>
<p>如果一个博客的广告横幅每月有10万次页面浏览量，CPM价格为1美元，那么这个博客的主人每月的广告收入就是100美元。</p>
<p>广告联盟、广告投放位置以及广告样式都会影响到CPM价格。广告联盟越好，吸引的广告投放商越多，CPM价格就越高。广告距离页面最上方越近，CPM价格也就越高。广告尺寸越大（以像素为单位），CPM价格越高。</p>
<p>CPM有时只有0.1美元，有时又可高达10美元。 对人均访客页面点击率较高的网站来说，CPM广告是个不错的选择。</p>
<h3>3. 直接出售旗帜广告</h3>
<p>直接出售网站上的广告位也是一种赚钱方式。首先这种方式避免了支付给中间商的必需费用，其次你可以自己决定广告费用。最常见的旗帜广告是728×90横幅广告、120×600竖幅广告、300×250方形广告以及125×125按钮广告。</p>
<p>直接出售旗帜广告不好的地方是，如果你的读者群不够庞大，广告商就不会在你的网站上投放广告。此外你还需要花时间来销售自己的广告位、商谈支付事宜等。</p>
<h3>4. 文字链接广告</h3>
<p>自Google宣布会对出售不带nofollow标签的文字广告的行为进行处罚后，这种赚钱方式开始逐渐衰落。</p>
<p>尽管如此，很多站长仍然没有停止使用文字广告，其中有些使用nofollow标签，有些仍然没有使用。</p>
<p>文字广告的好处是不会对访客造成困扰。站长们可以直接出售文字广告，也可以通过Text-Link-Ads 以及Text-Link-Brokers等专业联盟。</p>
<h3>5. 广告联盟推广</h3>
<p>加入某个广告联盟也是一种常见的互联网推广方式。你可以选择一家服务提供商并申请成为会员，然后在自己的网站上直接或间接出售这家提供商的产品或服务，从而获取一定佣金。这种方式也可以叫做CPA（Cost per Action）或CPL（Cost per Lead）。</p>
<p>你可以寻找个人公司进行合作，也可以加入各种已有的联盟。</p>
<h3>6. 赚钱工具</h3>
<p>通过Widgetbucks、SmartLinks等赚钱工具来盈利是一种最新的网赚趋势。这种方式可基于PPC，也可以基于文本链接广告或联盟链接。</p>
<p>但赚钱工具和它们的最大差别是，赚钱工具以“网络工具”形式存在，更方便用户放置，也更容易发挥作用。</p>
<h3>7. 付费评论</h3>
<p>这是一种相对受争议的赚钱方式。不是所有站长都愿意为某种产品或某个网站做付费评论。</p>
<p>不过这的确是种回报较高的网赚方式。</p>
<h3>8. RSS 订阅广告</h3>
<p>互联网上存在着数百万使用RSS订阅的用户，这就决定了RSS订阅也将成为网赚商机。</p>
<p>你可以注册那些支持显示footer广告的订阅服务提供商，也可以出售自己RSS订阅的广告位。</p>
<h3>9. 寻找赞助商</h3>
<p>如果你的网站上有个特定栏目（比如人物采访、运动特别报道等），你可以为这些栏目寻找相关的赞助商。</p>
<p>这种方法让站长多了一种盈利方式，也使广告投放商可以更有针对性的投放广告，同时也免去了和第三方合作必需的成本。</p>
<h3>10. 付费内容</h3>
<p>互联网上提供的信息大多是免费的，但也不乏提供付费内容的网站，比如付费小说、付费工具、付费服务网站等。</p>
<p>也可以设置付费会员，访客缴纳一定费用成为会员后，就可以免费享受网站提供的有偿服务。</p>
<p>只要能够提供和价格相称的服务，这也是一种不错的赚钱方式。</p>
<h3>11. 工作发布板</h3>
<p>站长们可以给自己的网站开辟一个“招聘”版块，发布一些工作信息，然后向信息发布者收取一定费用。</p>
<p>当然这种方式对站长要求比较高：首先网站本身要针对某个特定领域，其次需要具有相当可观的流量。</p>
<p>通过发布工作信息赚钱，好处在于：只要站长具备上述条件并架设好了工作发布版块，各方人士自然会开始关注并要求发布工作信息，然后站长就可以坐等入账啦。</p>
<h3>12. 交易型网站</h3>
<p>根据网站所属行业，让访客在自己的网站上发布行业产品的供求信息。一段时间后，如果有成效，可以开始向发布信息的人收取一定费用。很多B2B或者C2C网站都通过这种方式盈利。</p>
<p>不过这种方式的问题在于，没有一个标准的交易信息发布软件供人使用，站长需要自己动手或者请人编写相关代码并整合到自己的网站上。</p>
<h3>13. 付费调查、投票</h3>
<p>有些服务提供商会要求在你的网站上发布一个调查或者投票，然后向你支付一定费用。</p>
<p>这是国外常见的网赚方式，Vizu Answers就是一个有名的付费调查服务网站。</p>
<p>首先你需要成为该网站的注册会员，然后选择你希望投放在自己网站上的投票。这种方式也是基于CPM模式。</p>
<h3>14. 出售或出租网站内页</h3>
<p>这种方式很久前就已经存在，只是一直没有得到推广。把网站上的某个页面出租或出售给别人，也可以从中得到一定收入。不过买家通常会选择PR较高或者流量较大的网站，所以小型网站采用这种方式效果并不理想。值得推荐的是这种概念，如果多加研究，说不定可以看到其它希望。</p>
<h3>15. 高亮显示赞助商发布的文章</h3>
<p>有赞助商或者其它内容购买者的网站可以选择这种方法。</p>
<p>这种方式在国内也不多见，不过BAIDU可以说是这方面的老手了。</p>
<h3>16. 请求捐赠</h3>
<p>国内直接在网站上摆出“捐赠”字样的网站也不多。但这在国外也是相当普遍的网赚方式， 小到个人博客，大到维基百科，都可以选择这种方式获取收入。只要站长觉得读者可以从自己的网站内容受益，就可以在网站上挂出“给我们捐赠”的招牌。</p>
<p>WordPress的 <a href="http://www.blogclout.com/blog/goodies/buy-me-a-beer-paypal-donation-plugin/">Buy Me a Beer</a>插件就是“请求捐赠”的变体。利用这款插件你可以在每篇文章的结尾处加上一句话，请读者给你的网站做点贡献。</p>
<h3>17. 文内广告</h3>
<p>文章里带链接的广告文字通常以双下划线标注，以区别普通链接文字。访客将鼠标停留在链接上时，广告就会随着弹出。如果访客点击了弹出的广告，站长就可以获得收入。</p>
<p>有些网站靠这种方式发财，但也有很多网站不愿意选择这种网赚方式，认为对访客的干扰较大。选择这种盈利方式的主流网站的确很少。</p>
<h3>18. 弹出式广告</h3>
<p>弹出式广告既是一种相当普遍的网赚方式，也是相当惹人厌的一种。如果你建站的目的就是为了赚钱，那么就选择这种弹出式广告吧。</p>
<p>但从增加流量、培养长期访客的角度来说，弹出式广告是不可取的。从各种各样的弹出窗口阻止程序可以看出，弹出式广告的确不是那么受访问者欢迎。</p>
<h3>19. 音频广告</h3>
<p>音频广告网赚方式又叫PPP（Pay Per Play，按播放次数付费），其操作方式为：一旦有访客进入网站时，一个为时5秒左右的小音频广告会自动播放。访客无法中断这种广告，因此按照访客人数来算，广告的“点击率”是100%。</p>
<p>当然，这也是一种非常有干扰性的广告。决定采用这种方式赚钱前请三思。</p>
<h3>20. 出售整个网站</h3>
<p>这算是网赚里能在短期内获得较大数额入账的终极方式了，不过也是最无路可退的方式了。.网站价格受网站质量、领域以及其它各种因素的制约。</p>
<p>不过也有把网站当成买卖，为了出售网站而建站或购站的人。</p>
<p>间接方式</p>
<p>与前面介绍的直接网赚方式相比，下面将要说到的间接方式主要是基于网站本身的定位。</p>
<h3>21. 推销电子书</h3>
<p>在网站上推广相关的电子书，这是最古老的网赚方式之一，也是一种非常有效的盈利方式。</p>
<p>你可以根据书的内容来构建网站，也可以在网站的基础上推出电子书。</p>
<h3>22. 出售网站模板</h3>
<p>越来越旺盛的网站需求决定了网站及其周边也将成为炙手可热的商品。而网站模板正是网站的重要组成部分。</p>
<p>WordPress爱好者开发出数千种免费的模板和插件，但购买付费模板、插件的仍然大有人在。</p>
<p>国内也有提供模板定制服务的网站。</p>
<h3>23. 提供咨询及其它相关服务</h3>
<p>提供与你的网站领域相关的付费咨询服务或其他服务也是网赚方式之一。如果你是网站内容的主笔者，那么你提供的服务将更有说服力，也可以更直观地对客户产生影响。</p>
<h3>24. 提供付费教程或培训</h3>
<p>人们很乐意为教导他们并给他们灌输更多知识（而非信息）的人付费。正因为如此，教育才成为世界上最大行业之一。也正因为如此，在线教育的前景才更有可看性。</p>
<p>对网赚方式的介绍到这里就结束了。</p>
<p>就像上篇里几位TX的留言一样，“流量为王”，没有流量的话赚钱的确是无从说起。具体该如何实际操作，还是要看各位看官如何各显神通了。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.bthome.com.cn/2010/09/15/%e5%a6%82%e4%bd%95%e5%88%a9%e7%94%a8%e7%bd%91%e7%ab%99%e8%b5%9a%e9%92%b1/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

