<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0">
<channel>
<title><![CDATA[Everyday NetLog]]></title> 
<link>https://blog.zhoz.com/index.php</link> 
<description><![CDATA[z-NetLog]]></description> 
<language>zh-cn</language> 
<copyright><![CDATA[Everyday NetLog]]></copyright>
<item>
<link>https://blog.zhoz.com/read.php?806</link>
<title><![CDATA[为解决Chrome引发的cross site cookes问题：SameSite=None; Secure]]></title> 
<author> &lt;&gt;</author>
<category><![CDATA[PHP]]></category>
<pubDate>Thu, 27 Feb 2020 11:10:21 +0000</pubDate> 
<guid>https://blog.zhoz.com/read.php?806</guid> 
<description>
<![CDATA[ 
	这个问题，我调查了很久记录一下。分享给有缘人。<br/><br/>首先看看SameSite=None; Secure设置方法：<br/>php新版本可以直接在setcookie中设置，这里只发老版本：<br/>header("Set-Cookie: $cookie_name=$zhoz_code; SameSite=None; Secure");<br/><br/>Js：<br/>//set cookies<br/>function setCookie(name,value) &#123;<br/>&nbsp;&nbsp;var Days = 30;<br/>&nbsp;&nbsp;var exp = new Date();<br/>&nbsp;&nbsp;var topDomain = getTopDomain();<br/>&nbsp;&nbsp;exp.setTime(exp.getTime() + Days*24*60*60*1000);<br/>//&nbsp;&nbsp;document.cookie = name + "="+ escape (value) + ";expires=" + exp.toGMTString() + "; domain=" + topDomain + ";path=/";<br/>&nbsp;&nbsp;document.cookie = name + "="+ escape (value) + ";expires=" + exp.toGMTString() + "; domain=" + topDomain + ";path=/;SameSite=None;Secure";<br/>&#125;<br/><br/>附加一下Js高级写法，js变量传给php，看不懂就算了。<br/>var search = window.location.search;<br/>var js_sid = getParamString('sid', search);<br/>var xmlHttp;<br/>if (typeof(js_sid) != "undefined" && js_sid != '') &#123;<br/>&nbsp;&nbsp;xmlHttp=new XMLHttpRequest();<br/>&nbsp;&nbsp;if (xmlHttp!=null) &#123;<br/>&nbsp;&nbsp;&nbsp;&nbsp;var url="<?=HOST_URL ?>/zhoz_track.php?acode=<?=$acode ?>&js_sid="+js_sid+"&r=" + Math.round(Math.random() * 10000);<br/>&nbsp;&nbsp;&nbsp;&nbsp;var new_element=document.createElement('script');<br/>&nbsp;&nbsp;&nbsp;&nbsp;new_element.setAttribute('type','text/javascript');<br/>&nbsp;&nbsp;&nbsp;&nbsp;new_element.setAttribute('src',url);<br/>&nbsp;&nbsp;&nbsp;&nbsp;document.body.appendChild(new_element);<br/>&nbsp;&nbsp;&#125;<br/>&#125;<br/><br/><strong>2023/3/15补充：</strong><br/>如果您在本网站中设置了cookie，但在第三方网站上进行了POST请求后，再跳回到本站页面时无法获取之前设置的cookie，这可能是由于浏览器的SameSite策略引起的。<br/><br/>SameSite策略是一种用于增强Web安全性的浏览器安全机制，它可以防止跨站点请求伪造（CSRF）攻击。当浏览器检测到跨站点POST请求时，如果该请求来自于另一个域名，则会阻止该请求中的cookie在本站点进行使用。<br/><br/>为了解决这个问题，可以将设置的cookie的SameSite属性设置为None。例如：<br/><br/>//php7.2-<br/>$t = time() + 60 * 60 * 24 * 365 * 10;<br/>//setcookie("agree_use_cookie", 1, $t);<br/>setcookie("agree_use_cookie", 1, $t, "/; SameSite=None; Secure");<br/><br/>//php7.3+<br/>setcookie('agree_use_cookie', '1', [<br/>&nbsp;&nbsp;&nbsp;&nbsp;'expires' =>$t,<br/>&nbsp;&nbsp;&nbsp;&nbsp;'path' => '/',<br/>&nbsp;&nbsp;&nbsp;&nbsp;'secure' => true,<br/>&nbsp;&nbsp;&nbsp;&nbsp;'samesite' => 'None'<br/>]);<br/>Tags - <a href="https://blog.zhoz.com/tag.php?tag=%25E6%25B5%258F%25E8%25A7%2588%25E5%2599%25A8" rel="tag">浏览器</a> , <a href="https://blog.zhoz.com/tag.php?tag=js" rel="tag">js</a> , <a href="https://blog.zhoz.com/tag.php?tag=%25E6%25BA%2590%25E7%25A0%2581" rel="tag">源码</a>
]]>
</description>
</item><item>
<link>https://blog.zhoz.com/read.php?770</link>
<title><![CDATA[php正则抓取淘宝、亚马逊、京东指定商品的价格等信息]]></title> 
<author> &lt;&gt;</author>
<category><![CDATA[PHP]]></category>
<pubDate>Wed, 26 Nov 2014 09:17:38 +0000</pubDate> 
<guid>https://blog.zhoz.com/read.php?770</guid> 
<description>
<![CDATA[ 
	指定页面Url，用php正则抓取淘宝、亚马逊、京东指定商品的价格等信息<br/>已测试，京东不能直接抓取，需要先写个Js来模拟生成数据，再进行抓取。<br/>等需要的时候，再补上方法。<br/><br/><textarea name="code" class="PHP" rows="15" cols="100">
// taobao
$url = "http://item.taobao.com/item.htm?id=7776160227";
//$data = file_get_contents($url);
//$pattern = array('&#92;<em class="tb-rmb-num"&#92;>&#92;S+&#92;<&#92;/em&#92;>', '<span class="tm-price-item">37.00元/500g</span>');
//preg_match_all("/" . $pattern . "/", $data, $out, PREG_SET_ORDER);


// jd.com TODO
$url = "http://item.jd.com/1220040.html";
//$data = file_get_contents($url);
//$pattern = '&#92;<strong class="p-price" id="jd-price"&#92;>&#92;S+&#92;<&#92;/strong&#92;>';
//preg_match_all("/" . $pattern . "/", $data, $out, PREG_SET_ORDER);


// amazon
$url = "http://www.amazon.cn/gp/product/B00DOQBSA8/ref=fs_kfhdx";
$data = file_get_contents($url);
$pattern = '&#92;<b class="priceLarge kitsunePrice"&#92;>.*<&#92;/b&#92;>';
preg_match_all("/" . $pattern . "/", $data, $out, PREG_SET_ORDER);

//print_r($data);
print_r($out);
</textarea><br/>Tags - <a href="https://blog.zhoz.com/tag.php?tag=%25E8%25BF%259C%25E7%25A8%258B%25E8%25B0%2583%25E7%2594%25A8%25E6%2589%25A7%25E8%25A1%258C" rel="tag">远程调用执行</a> , <a href="https://blog.zhoz.com/tag.php?tag=%25E5%258A%25A0%25E5%25AF%2586%252F%25E8%25A7%25A3%25E5%25AF%2586" rel="tag">加密/解密</a>
]]>
</description>
</item><item>
<link>https://blog.zhoz.com/read.php?738</link>
<title><![CDATA[PHP的异常原理与实例说明 Fatal error: Uncaught exception]]></title> 
<author> &lt;&gt;</author>
<category><![CDATA[PHP]]></category>
<pubDate>Mon, 25 Feb 2013 11:15:06 +0000</pubDate> 
<guid>https://blog.zhoz.com/read.php?738</guid> 
<description>
<![CDATA[ 
	PHP的异常原理<br/>PHP5+ 开始提供了一种新的面向对象的错误处理方法，用于在指定的错误（异常）情况发生时改变脚本的正常流程。这种情况称为异常。<br/> <br/>一般使用方法：<br/><textarea name="code" class="php" rows="15" cols="100"> 
<?php 
function zhoz_com_test() &#123; 
&nbsp;&nbsp;&nbsp;&nbsp;throw new Exception("异常啦"); 
&#125; 
try &#123; 
&nbsp;&nbsp;&nbsp;&nbsp; zhoz_com_test(); 
&#125; catch (Exception $e) &#123; 
 echo $e->getMessage(); 
&#125;
</textarea><br/>throw new Exception('XXX') ： 抛出一个异常<br/>try&nbsp;&nbsp;： 使用异常的函数应该位于 "try" 代码块内。如果没有触发异常，则代码将照常继续执行。但是如果异常被触发，会抛出一个异常。<br/>Catch：代码块会捕获异常，并创建一个包含异常信息的对象<br/>自定义异常类：<br/><textarea name="code" class="php" rows="15" cols="100">
class myException extends Exception &#123; 
 public function errorMessage() &#123; 
&nbsp;&nbsp;&nbsp;&nbsp;$errorMsg = 'zhoz.com Error on line '.$this->getLine().' in '.$this->getFile() 
&nbsp;&nbsp;.': <b>'.$this->getMessage().'</b> is not a valid E-Mail address'; 
&nbsp;&nbsp;&nbsp;&nbsp;return $errorMsg; 
&nbsp;&nbsp;&#125; 
&#125; 
 
 
try &#123; 
&nbsp;&nbsp;throw new myException($email); 
&#125;catch (myException $e)&#123; 
 echo $e->errorMessage(); 
&#125; 
</textarea><br/>myException类是一个自定义的异常类，必须继承Exception<br/>Exception是一个PHP自带的内置的异常类，默认情况下会使用PHP默认的内置异常类，但是我们可以通过自定义的方式，自定义成满足自己需求的异常类。<br/>使用自定义异常类的时候，throw new myException 抛出异常也需要抛出自定义的异常类类名<br/>catch的时候也需要捕获自定义的异常类<br/>如果抛出了异常而不捕获处理的话，就会发生PHP代码报错，如下：<br/>[sql] <br/>Fatal error: Uncaught exception 'myException' in D:&#92;AppServ&#92;www&#92;cctv&#92;trunk&#92;index.php:12 Stack trace: #0 &#123;main&#125;&nbsp;&nbsp;<br/>thrown in D:&#92;AppServ&#92;www&#92;cctv&#92;trunk&#92;index.php on line 12 <br/><br/>PHP默认异常类详细：<br/><textarea name="code" class="php" rows="15" cols="100"> 
class exception 
&#123; 
&nbsp;&nbsp;&nbsp;&nbsp;protected $message = 'Unknow exception'; //自定义的异常信息 
&nbsp;&nbsp;&nbsp;&nbsp;protected $code = 0; //定义的异常代码 
&nbsp;&nbsp;&nbsp;&nbsp;protected $file; //发生异常的PHP程序名 
&nbsp;&nbsp;&nbsp;&nbsp;protected $line; //发生异常的PHP行号 
&nbsp;&nbsp;&nbsp;&nbsp;//用于传递用户自定义异常信息和用户自定义异常代码的构造函数 
&nbsp;&nbsp;&nbsp;&nbsp;function __construct($message=null,$code=0); 
&nbsp;&nbsp;&nbsp;&nbsp;final function getMessage(); 
&nbsp;&nbsp;&nbsp;&nbsp;final function getCode(); 
&nbsp;&nbsp;&nbsp;&nbsp;final function getFile(); 
&nbsp;&nbsp;&nbsp;&nbsp;final function getLine(); 
&nbsp;&nbsp;&nbsp;&nbsp;final function getTrace(); //以数组形式返回异常传递的路线 
&nbsp;&nbsp;&nbsp;&nbsp;final function getTraceAsString(); //返回格式化成字符串的getTrace函数信息 
&nbsp;&nbsp;&nbsp;&nbsp;function __toString(); //可重载，用于返回可输出的字符串 
&#125;
</textarea><br/>可以看到PHP默认异常类中有很多自定义变量和方法<br/>$e->getMessage 一般是获取错误信息<br/>$e->getCode() 一般是获取错误码<br/>$e->getFile() 获取错误的文件信息<br/>$e->getLine() 获取错误行数<br/>$e->getTrace() 异常经过的文件路径<br/>__toString() 一般可以重载，用于返回可输出的字符串<br/>PHP异常类的作用：<br/>捕获异常，一般可以在MYSQL链接不上，或者业务逻辑错误的时候，抛出异常，在代码最顶端接收。<br/>异常分析处理。可以在出异常的时候，捕获到异常的错误信息，写入日志。<br/>可以返回友好化的提示信息，例如WEB端可以返回页面形式，也可以在AJAX端返回JSON数据格式。<br/>原则：如果异常抛出了，就必须捕获它，否则会PHP报错。<br/> <br/>Tags - <a href="https://blog.zhoz.com/tag.php?tag=%25E5%25BC%2582%25E5%25B8%25B8%25E5%25A4%2584%25E7%2590%2586" rel="tag">异常处理</a> , <a href="https://blog.zhoz.com/tag.php?tag=%25E7%25B3%25BB%25E7%25BB%259F%25E9%2594%2599%25E8%25AF%25AF" rel="tag">系统错误</a>
]]>
</description>
</item><item>
<link>https://blog.zhoz.com/read.php?719</link>
<title><![CDATA[php查询文件并取得行数、条数等方法]]></title> 
<author> &lt;&gt;</author>
<category><![CDATA[PHP]]></category>
<pubDate>Mon, 03 Dec 2012 12:58:22 +0000</pubDate> 
<guid>https://blog.zhoz.com/read.php?719</guid> 
<description>
<![CDATA[ 
	php读取文件，查找行数及查找关键字方法。<br/><br/><textarea name="code" class="PHP" rows="15" cols="100">
<?php
ini_set("memory_limit", "1024M");
set_time_limit(0);

$filename="./php_error.log.txt";
$search_text = ", 'http://zhoz.com";
$file_array = file($filename);

$count = 1;
foreach($file_array as $line_num=>$line_value) &#123;
&nbsp;&nbsp;if (preg_match("/" . addcslashes($search_text, "/") . "/", $line_value)) &#123;
&nbsp;&nbsp;&nbsp;&nbsp;echo $count . ": " . $line_value . "<br /><br />";
&nbsp;&nbsp;&nbsp;&nbsp;$count++;
&nbsp;&nbsp;&#125;
&#125;
?>
</textarea><br/>Tags - <a href="https://blog.zhoz.com/tag.php?tag=%25E6%2590%259C%25E7%25B4%25A2%25E5%25BC%2595%25E6%2593%258E%25E4%25BC%2598%25E5%258C%2596seo" rel="tag">搜索引擎优化seo</a>
]]>
</description>
</item><item>
<link>https://blog.zhoz.com/read.php?708</link>
<title><![CDATA[zend解密真的有效-Dezender]]></title> 
<author> &lt;&gt;</author>
<category><![CDATA[PHP]]></category>
<pubDate>Thu, 08 Nov 2012 10:54:34 +0000</pubDate> 
<guid>https://blog.zhoz.com/read.php?708</guid> 
<description>
<![CDATA[ 
	下载：<br/>http://down.chinaz.com/soft/20941.htm<br/><br/>使用：<br/>解压到E盘，然后进入E:&#92;Dezender&#92;PHP5&#92;PHP5，修改php.ini文件的最后两行，修改成如下：<br/><br/>zend_extension_manager.optimizer_ts="E:&#92;DeZender&#92;Zend for PHP5&#92;"<br/>zend_extension_ts="E:&#92;Dezender&#92;Zend for PHP5&#92;Zend for PHP5&#92;Optimizer-3.3.0&#92;php-5.2.x&#92;ZendOptimizer.dll"<br/><br/>根据你要解密的php文件的版本来，如果是php-5.1的就修改成php-5.1.x，它支持php4和php5几乎所有的版本。<br/>这里的zhoz.php是放在E:&#92;Dezender&#92;PHP5&#92;PHP5目录下的，如果是其他地方，就需要使用绝对路径。<br/>执行完，会自动生成一个zhoz.de.php的解密后的文件。<br/><br/>D:&#92;Dezender&#92;PHP5&#92;PHP5>php.exe zhoz.php<br/>X-Powered-By: PHP/5.2.1<br/>Content-type: text/html<br/>Tags - <a href="https://blog.zhoz.com/tag.php?tag=%25E5%258A%25A0%25E5%25AF%2586%252F%25E8%25A7%25A3%25E5%25AF%2586" rel="tag">加密/解密</a> , <a href="https://blog.zhoz.com/tag.php?tag=zend" rel="tag">zend</a> , <a href="https://blog.zhoz.com/tag.php?tag=%25E6%25BA%2590%25E7%25A0%2581" rel="tag">源码</a>
]]>
</description>
</item><item>
<link>https://blog.zhoz.com/read.php?692</link>
<title><![CDATA[zend framework文件上传并改名类的使用]]></title> 
<author> &lt;&gt;</author>
<category><![CDATA[PHP]]></category>
<pubDate>Wed, 12 May 2010 17:05:52 +0000</pubDate> 
<guid>https://blog.zhoz.com/read.php?692</guid> 
<description>
<![CDATA[ 
	前天研究了一下午，发现zend framework里的文件上传处理，以下2个方法是行不通的：<br/>1、.tpl里的表单直接提交到控制器中，但用传统的$_POST将获取不到任何值；<br/>2、zend framework框架中，单独写PHP文件，是无法直接访问的，只能得到以下的404信息：<br/>Invalid controller specified (index)<br/>传统方法是行不通了，立即转换思路，从Zend的底层寻找方法，原来只需要以下几行代码就可以解决所有的check 、报错等信息。<br/><textarea name="code" class="php" rows="15" cols="100">

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// ファイルアップ
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$adapter = new Zend_File_Transfer_Adapter_Http();
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// チェックパラメータ
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$adapter->setDestination($dir);
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$adapter->addValidator('Extension', false, implode(",", $format));
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$adapter->addValidator('Size', false, 102400 * 2 * 1024);
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$adapter->addValidator('Count', false, 1);
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$adapter->addValidator('FilesSize', false, array (
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'min' => '1kB',
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'max' => '2MB'
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;));
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// 修改文件名方法
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$adapter->addFilter('Rename', array (
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'target' => './data/' . time() . '.' . strtolower(substr(strrchr($adapter->getFileName(), "."), 1)),
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'overwrite' => true
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;));
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// アップ情報
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if (!$adapter->receive()) &#123;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$messages_list = $adapter->getMessages();
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;foreach ($messages_list as $tmp) &#123;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$messages .= $tmp . "<br />";
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#125;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#125; else &#123;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$messages = 'ファイルをアップしました';
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#125;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</textarea><br/><br/>以上的修改文件名方法，感谢大师兄提供，我开始是修改低层Zend/File/Transfer/Adapter/Http.php来实现的：<br/><textarea name="code" class="php" rows="15" cols="100">
// rename by zhouz 2010/5/12
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$sid = 7; //test用

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$extname = strtolower(substr(strrchr($content['name'], "."), 1));
&nbsp;&nbsp;&nbsp;&nbsp;$content['name'] = "SENQ_" . $sid . "." . $extname;

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$filename = $directory . $content['name'];
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$rename&nbsp;&nbsp; = $this->getFilter('Rename');
</textarea><br/>Tags - <a href="https://blog.zhoz.com/tag.php?tag=%25E6%2596%2587%25E4%25BB%25B6%25E4%25B8%258A%25E4%25BC%25A0" rel="tag">文件上传</a> , <a href="https://blog.zhoz.com/tag.php?tag=framework" rel="tag">framework</a> , <a href="https://blog.zhoz.com/tag.php?tag=zend" rel="tag">zend</a>
]]>
</description>
</item><item>
<link>https://blog.zhoz.com/read.php?685</link>
<title><![CDATA[ZendServer oci8.so - libaio.so.1: cannot open shared object file]]></title> 
<author> &lt;&gt;</author>
<category><![CDATA[PHP]]></category>
<pubDate>Wed, 28 Apr 2010 06:26:16 +0000</pubDate> 
<guid>https://blog.zhoz.com/read.php?685</guid> 
<description>
<![CDATA[ 
	ZendServer其实本身自带Oci8的Oracle扩展……<br/>但发现在phpinfo中始终没有加载成功，即看不到Oci8的信息。<br/>enderServer有管理端。。无意中跑到里面看到有加载报错日志。。。<br/>[27-Apr-2010 17:45:34] PHP Warning:&nbsp;&nbsp;PHP Startup: Unable to load dynamic library '/usr/local/zend/lib/php_extensions/oci8.so' - libaio.so.1: cannot open shared object file: No such file or directory in Unknown on line 0<br/>在国外的一个站上看到了这样的信息：sudo apt-get install libaio1<br/>于是按下面的方法，问题解决：<br/> yum install libaio.i386<br/><br/><br/>Tags - <a href="https://blog.zhoz.com/tag.php?tag=%25E4%25B8%25BB%25E6%259C%25BA%25E9%2585%258D%25E7%25BD%25AE" rel="tag">主机配置</a> , <a href="https://blog.zhoz.com/tag.php?tag=%25E7%25A8%258B%25E5%25BA%258F%25E5%25AE%2589%25E8%25A3%2585" rel="tag">程序安装</a> , <a href="https://blog.zhoz.com/tag.php?tag=oracle" rel="tag">oracle</a>
]]>
</description>
</item><item>
<link>https://blog.zhoz.com/read.php?684</link>
<title><![CDATA[国外Php开源建站平台收集]]></title> 
<author> &lt;&gt;</author>
<category><![CDATA[PHP]]></category>
<pubDate>Sat, 24 Apr 2010 19:19:01 +0000</pubDate> 
<guid>https://blog.zhoz.com/read.php?684</guid> 
<description>
<![CDATA[ 
	大量的PHP开源（开放源代码/Open Source）应用改变了这个世界，免费资源改变了互联网，以下总结从数据库到购物、博客等众多类型的开源PHP软件，供以后开发参考。<br/><br/><br/><br/>WordPress是使用PHP开发的著名博客平台，免费开源，功能强大，不仅仅用于博客搭建，还可以广泛应用于各类网络信息发布平台。<br/><br/>论坛：phpBB<br/><br/>phpBB是一种广泛流行的开源论坛软件，具有易于使用的管理面板和友好的用户安装界面，可以轻松地在数分钟内建立起一个论坛，功能上具有很高的可配置性，能够完全定制出相当个性化的论坛。<br/><br/><strong>CMS：Drupal</strong><br/><br/>Drupal是一个开源的内容管理系统(CMS)平台，拥有强大并可自由配置的功能，能支持从个人博客到大型社区驱动的网站等各种不同应用的网站项目。<br/><br/><strong>Wiki：MediaWiki</strong><br/><br/>MediaWiki是PHP语言写成开源Wiki引擎，全世界最大的Wiki项目维基百科就是使用MediaWiki引擎。<br/><br/>Digg：Pligg<br/><br/>Pligg是一套灵活的类似Digg的Web2.0 CMS系统，系统使用PHP开发，模仿了国外流行的DIGG系统。<br/><br/>图像：Gallery<br/><br/>Gallery 是一个非常有名的免费开源图库相册软件，基于 PHP 和 MySQL， PostgreSQL 等数据库。功能非常强大，有丰富的扩展可以下载，安装很简单，有很多插件可用。<br/><br/>RSS：Gregarius<br/><br/>Gregarius是一个RSS聚合程序，免费开源，具备不错的用户体验，易于操作和管理。可以把其当成RSS阅读器使用。<br/><br/>电子商务：osCommerce<br/><br/>osCommerce是一套由自由软件开发社团开发并维护的在线商店的解决方案，免费开源，并可以应用到任何的商业环境中，可以在短时间内生成一个功能强大的电子商务网站。<br/><br/>广告：OpenX<br/><br/>OpenX（原名phpAdsNew）是一个用PHP开发的广告管理与跟踪系统，适合各类网站使用，能够管理每个广告主拥有的多种任何尺寸横幅广告，按天查看，详细和概要统计并通过电子邮件发送报表给广告主。<br/><br/>数据库：phpMyadmin<br/><br/>phpMyAdmin是用PHP开发的MySQL的数据库管理工具。可以在Web界面上实现各种各样对MySQL数据库的管理和操作。<br/><br/><br/>Tags - <a href="https://blog.zhoz.com/tag.php?tag=%25E8%25B0%2583%25E7%25A0%2594%25E6%258A%25A5%25E5%2591%258A" rel="tag">调研报告</a> , <a href="https://blog.zhoz.com/tag.php?tag=%25E5%2585%258D%25E8%25B4%25B9%25E8%25B5%2584%25E6%25BA%2590" rel="tag">免费资源</a> , <a href="https://blog.zhoz.com/tag.php?tag=%25E6%25BA%2590%25E7%25A0%2581" rel="tag">源码</a>
]]>
</description>
</item><item>
<link>https://blog.zhoz.com/read.php?677</link>
<title><![CDATA[php获取网卡MAC地址类]]></title> 
<author> &lt;&gt;</author>
<category><![CDATA[PHP]]></category>
<pubDate>Fri, 26 Mar 2010 02:21:31 +0000</pubDate> 
<guid>https://blog.zhoz.com/read.php?677</guid> 
<description>
<![CDATA[ 
	忽然想到，判断同机登陆的问题。记录MAC是个好办法，顺便查了这个PHP方法，备注以便以后使用。<br/>实现很简单，就是分别调用系统命令，返回到数组中。<br/><textarea name="code" class="php" rows="15" cols="100">
&lt;?php
class GetMacAddr
&#123;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;var $return_array = array(); // 返回带有MAC地址的字串数组
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;var $mac_addr=array();
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;function GetMacAddr()
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#123;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; switch (strtolower(PHP_OS) )
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#123;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;case &quot;linux&quot;:$this-&gt;forLinux();break;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;case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bsp;&nbsp;&nbsp;&nbsp;&nbsp;unset($temp_array);
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return $this-&gt;mac_addr;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#125;

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;function forWindows()
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#123;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;@exec(&quot;ipconfig /all&quot;, $this-&gt;return_array);
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if ( $this-&gt;return_array )
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return $this-&gt;return_array;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;else&#123;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$ipconfig = $_SERVER[&quot;WINDIR&quot;].&quot;&#92;system32&#92;ipconfig.exe&quot;;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if ( is_file($ipconfig) )
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; @exec($ipconfig.&quot; /all&quot;, $this-&gt;return_array);
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;else
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; @exec($_SERVER[&quot;WINDIR&quot;].&quot;&#92;system&#92;ipconfig.exe /all&quot;, $this-&gt;return_array);
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return $this-&gt;return_array;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#125;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#125;

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;function forLinux()
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#123;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;@exec(&quot;ifconfig -a&quot;, $this-&gt;return_array);
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return $this-&gt;return_array;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#125;
&#125;

$mac = new GetMacAddr();
echo &quot;&lt;pre&gt;&quot;;
print_r( $mac-&gt;mac_addr);
?&gt;

</textarea><br/>Tags - <a href="https://blog.zhoz.com/tag.php?tag=%25E4%25B8%25BB%25E6%259C%25BA%25E9%2585%258D%25E7%25BD%25AE" rel="tag">主机配置</a> , <a href="https://blog.zhoz.com/tag.php?tag=%25E7%25B1%25BB%25E6%2596%25B9%25E6%25B3%2595" rel="tag">类方法</a>
]]>
</description>
</item><item>
<link>https://blog.zhoz.com/read.php?676</link>
<title><![CDATA[php 返回目录下的所有文件名/文件夹类]]></title> 
<author> &lt;&gt;</author>
<category><![CDATA[PHP]]></category>
<pubDate>Tue, 23 Mar 2010 08:28:04 +0000</pubDate> 
<guid>https://blog.zhoz.com/read.php?676</guid> 
<description>
<![CDATA[ 
	PHP读取目录树下的文件及目录方法。<br/>这里为了便于演示，直接列出来了，其中可以返回数组之类的，根据需要另作改动。<br/>代码如下，可以直接Copy测试。<br/><textarea name="code" class="php" rows="15" cols="100">
&lt;?php
 main();

 function main()&#123;
 //Set Variables
 $testDirName = &quot;./zhoz/&quot;;
 $fileListArray = array();
 $dirListArray = array();

$aDirectory = new DirReader($testDirName);

// Store File List in Array
$fileListArray = $aDirectory-&gt;getFileList();
$dirListArray = $aDirectory-&gt;getDirList();

echo &quot;&lt;html&gt;&lt;body&gt;&#92;n&quot;;
echo &quot;&lt;pre&gt;&#92;n&quot;;


echo &quot;Reading Directory: &quot;.&nbsp;&nbsp;$aDirectory-&gt;getDirPath() .&quot;&#92;n&quot;;
echo &quot;Current Directory: &quot;. getcwd() .&quot;&#92;n&quot;;

echo &quot;-- Files in Directory --&#92;n&quot;;
foreach ($fileListArray as $filename) &#123;
&nbsp;&nbsp;&nbsp;&nbsp;echo &quot;File: $filename&#92;n&quot;;
&#125;

echo &quot;&#92;n-- Sub Directories --&#92;n&quot;;
foreach ($dirListArray as $filename)&#123;
&nbsp;&nbsp;&nbsp;&nbsp;echo &quot;Sub dir: $filename&#92;n&quot;;
&#125;
echo &quot;&lt;/pre&gt;&lt;/body&gt;&lt;/html&gt;&#92;n&quot;;
&#125;

class DirReader&#123;
&nbsp;&nbsp;private $dh;
&nbsp;&nbsp;private $basedir;
&nbsp;&nbsp;private $fileNameArray=array();
&nbsp;&nbsp;private $dirNameArray=array();

&nbsp;&nbsp;function __construct($dirname)&#123;
&nbsp;&nbsp;&nbsp;&nbsp;$this-&gt;basedir = $dirname;
&nbsp;&nbsp;&nbsp;&nbsp;$this-&gt;dh = dir($dirname) or die($php_errormsg);
&nbsp;&nbsp;&nbsp;&nbsp;$this-&gt;parseDirectory();
&nbsp;&nbsp;&#125;

&nbsp;&nbsp;function parseDirectory()&#123;
&nbsp;&nbsp;&nbsp;&nbsp;$filename = &quot;&quot;;
&nbsp;&nbsp;&nbsp;&nbsp;while (false !== ($filename = $this-&gt;dh-&gt;read()))&#123;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$fullpath = $this-&gt;basedir . &#039;/&#039; . $filename;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if (is_file($fullpath))&#123;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;array_push($this-&gt;fileNameArray, $filename);
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#125;else&#123;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;array_push($this-&gt;dirNameArray, $filename);
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#125;
&nbsp;&nbsp;&nbsp;&nbsp;&#125;
&nbsp;&nbsp;&#125;


&nbsp;&nbsp;// Get all the files in the directory
&nbsp;&nbsp;function getFileList()&#123;
&nbsp;&nbsp;&nbsp;&nbsp;return $this-&gt;fileNameArray;
&nbsp;&nbsp;&#125;

&nbsp;&nbsp;// Get all the sub directories in the directory
&nbsp;&nbsp;function getDirList()&#123;
&nbsp;&nbsp;&nbsp;&nbsp;return $this-&gt;dirNameArray;
&nbsp;&nbsp;&#125;

&nbsp;&nbsp;function getDirPath()&#123;
&nbsp;&nbsp;&nbsp;&nbsp;return $this-&gt;dh-&gt;path;
&nbsp;&nbsp;&#125;
&#125;
</textarea><br/>Tags - <a href="https://blog.zhoz.com/tag.php?tag=%25E7%25B1%25BB%25E6%2596%25B9%25E6%25B3%2595" rel="tag">类方法</a>
]]>
</description>
</item>
</channel>
</rss>