<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Program/Php | Hessian's Blog</title><link>https://hessian.cn/cat/program/php</link><description>Hessian 的技术笔记：Linux、C++、网络与嵌入式</description><language>zh-CN</language><atom:link href="https://hessian.cn/cat/program/php/index.xml" rel="self" type="application/rss+xml"/><item><title>NGINX userid 分析、解码</title><link>https://hessian.cn/p/1362.html</link><pubDate>Wed, 18 Sep 2013 02:05:43 +0800</pubDate><guid>https://hessian.cn/p/1362.html</guid><description>生成userid的代码在 http/modules/ngx_http_userid_filter_module.c 大概550行左右。&#10;uid_set 是4个uint32构成的，其中比较有用的是第二个unit32，是userid的生成时间。第四个是一个递增值 以 0x03030302 为初始值，每次递增0x100。&#10;</description></item><item><title>从百度空间导入到WordPress</title><link>https://hessian.cn/p/679.html</link><pubDate>Mon, 21 May 2012 17:41:26 +0800</pubDate><guid>https://hessian.cn/p/679.html</guid><description>从此这里做主博了，于是写了个导入程序把我百度空间的东西也搬了过来，下次还得写个导入相册的。。。&#10;看了网上很多导入工具都是用的RSS来导入，会丢掉很多东西，而且一些被百度和谐掉的内容是抓取不到的，所以做了这么个工具通过采集的方式直接从HTML里抓取博客内容。&#10;</description></item><item><title>[转]php sphinx 高效率搜索引擎搭建</title><link>https://hessian.cn/p/192.html</link><pubDate>Sun, 20 May 2012 00:56:18 +0800</pubDate><guid>https://hessian.cn/p/192.html</guid><description>原文地址：http://blog.csdn.net/adparking/article/details/7207119&#10; &#10;1.下载PHP客户端安装:&#10;</description></item><item><title>ImageImagick + PHP + Apache On WINDOWS</title><link>https://hessian.cn/p/184.html</link><pubDate>Wed, 16 May 2012 14:14:19 +0800</pubDate><guid>https://hessian.cn/p/184.html</guid><description>今天帮同事安装配置php_imagick，结果装是装上了apache也能正常启动，但是程序一new Imagick()就会导致Apache崩溃。&#10;</description></item><item><title>PHP 中的 XML 拉模式解析</title><link>https://hessian.cn/p/643.html</link><pubDate>Wed, 26 Mar 2008 02:45:00 +0800</pubDate><guid>https://hessian.cn/p/643.html</guid><description>src:http://www.wujianrong.com/archives/2007/04/php_xml.html&#10;PHP 5 引入了新的类 XMLReader，用于读取可扩展标记语言（Extensible Markup Language，XML）。与 SimpleXML 或文档对象模型（Document Object Model，DOM）不同，XMLReader 以流模式进行操作。即它从头到尾读取文档。在文档后面的内容编译完成之前，可以先处理已编译好的文档前面的内容,从而实现非常快速、非常高效、非常节省地使用内存。需要处理的文档越大，这个特点就越发重要。&#10;</description></item><item><title>优化 PHP 建议</title><link>https://hessian.cn/p/372.html</link><pubDate>Mon, 03 Mar 2008 13:30:00 +0800</pubDate><guid>https://hessian.cn/p/372.html</guid><description>src: http://www.phpchina.com/78/viewspace_25713.html&#10;1.如果一个方法可静态化，就对它做静态声明。速率可提升至4倍。&#10;2.echo 比 print 快。&#10;3.使用echo的多重参数（译注：指用逗号而不是句点）代替字符串连接。&#10;4.在执行for循环之前确定最大循环数，不要每循环一次都计算最大值。&#10;</description></item><item><title>php中的MVC模式运用</title><link>https://hessian.cn/p/381.html</link><pubDate>Sat, 10 Nov 2007 19:51:00 +0800</pubDate><guid>https://hessian.cn/p/381.html</guid><description>首先我来举个例子:&#10;一个简单的文章显示系统&#10;简单期间,我们假定这个文章系统是只读的，也就是说这个例子将不涉及文章的发布，现在开始了。&#10;由于只涉及数据库的读取，所以我定义了两个interface&#10;</description></item><item><title>[转]PHP 中实现 Factory 模式</title><link>https://hessian.cn/p/341.html</link><pubDate>Sat, 10 Nov 2007 19:50:00 +0800</pubDate><guid>https://hessian.cn/p/341.html</guid><description>转自:http://blog.chinaunix.net/u/10599/showart_329537.html&#10;有这么一种观点：似乎没有 “Factory 模式”一说，GoF 的 23 个模式中与 Factory 相关的有两个：Factory Method 和 Abstract Factory ，《深入浅出设计模式》中则定义了一个 Simple Factory 模式。而本人( Hick ) 翻阅了一下相关资料，Robert C. Martin 的《Agile Software Development: Principles, Patterns, and Pracitces》直接提的是“Factory 模式”。具体情况有兴趣的可以去详细考证。&#10;“Factory 模式允许我们之依赖于抽象接口就能够创建出具体对象的实例”，是 DIP (依赖倒置原则)的体现。我们能够通过给一个工厂（factory）不同的需求来生产不同但是相似的产品(实例化对象)。&#10;嘿嘿，人说，最好的文档就是代码。我不仅仅这样说，我还可以证明给你看(在这里的显示效果不好，建议拷贝到 PHP 编辑器中看)，下面分别是《PHP 手册》、《Core PHP Programming》和《PHP 5 Power Programming》中 Factory 模式的实例解析：&#10;&lt;?php&#10;/**&#10;* factory 模式&#10;* * factory 的概念不像 Singleton 等模式那样， factory 模式比较&#10;* 灵活。通常根据不同的要求能够"生产不同对象"(实例化类)就可以&#10;* 归为 factory 模式或者其变体。&#10;*/&#10;/**&#10;* 先用手册中一个简单的例子说明 factory 模式&#10;* * 注意下面这段代码并不可执行，因为需要定义相应的数据库[Driver]类。&#10;*/&#10;class DbFactory&#10;{&#10;   // factory 方法&#10;   public static function factory($type)&#10;   {&#10;   // 注意这里的包含文件应该是相关数据库的[Driver]类&#10;   if (include_once ‘Drivers/‘ . $type . ‘.php‘) {&#10;   $classname = ‘Driver_‘ . $type;&#10;   return new $classname;&#10;   } else {&#10;   throw new Exception (‘Driver not found‘);&#10;   }&#10;   }&#10;}&#10;// 生成数据库(MySQL)连接对象，&#10;$DbCon = DbFactory::factory(‘MySQL‘);&#10;// $DbCon = DbFactory::factory(‘SQLite’);&#10;/**&#10;* "Core PHP Programming" 中的例子&#10;*/&#10;class Factory&#10;{&#10;   private $registeredClasses = array();&#10;      static private $instance = NULL;&#10;   private function __construct() {}&#10;   static function getInstance()&#10;   {&#10;   if(self::$instance == NULL)&#10;   {&#10;   self::$instance = new Factory();&#10;   }&#10;   return self::$instance;&#10;   }&#10;   function registerClass($id, $creator_func)&#10;   {&#10;   $this-&gt;registeredClasses[$id] = $creator_func;&#10;   }&#10;   function createObject($id, $args)&#10;   {&#10;   if(!isset($this-&gt;registeredClasses[$id]))&#10;   {&#10;   return(NULL);&#10;   }&#10;   return($this-&gt;registeredClasses[$id]($args));&#10;   }&#10;}&#10;class MyClass&#10;{&#10;   private $created;&#10;   public function __construct()&#10;   {&#10;   $created = time();&#10;   }&#10;   public function getCreated()&#10;   {&#10;   return($this-&gt;created);&#10;   }&#10;}&#10;function MyClassCreator()&#10;{&#10;   return(new MyClass());&#10;}&#10;$factory = Factory::getInstance();&#10;$factory-&gt;registerClass(1234, "MyClassCreator");&#10;$instance = $factory-&gt;createObject(1234, array());&#10;/**&#10;* "PHP 5 Power Programming" 中的对 factory 模式的诠释&#10;* * 一个 Factory 类通常都有一个方法负责接受参数，根据参数的不同来决定&#10;* "生产"哪个类的实例。下面拿网站的用户作为例子，作为实际运用：把网站&#10;* 用户分成匿名用户，普通(注册)用户，管理员。我们在类中进行用户的权限&#10;* 控制—这样能够更好的展现 factory 类在整个类体系中所扮演的角色。&#10;*/&#10;/**&#10;* 基类 User&#10;*/&#10;abstract class User {&#10;   public $name = null;&#10;      public function __construct($name)&#10;   {&#10;   $this-&gt;name = $name;&#10;   }&#10;      function getName()&#10;   {&#10;   return $this-&gt;name;&#10;   }&#10;      // 权限控制方法&#10;   function hasReadPermission()&#10;   {&#10;   return true;&#10;   }&#10;      function hasModifyPermission()&#10;   {&#10;   return false;&#10;   }&#10;      function hasDeletePermission()&#10;   {&#10;   return false;&#10;   }&#10;}&#10;// 匿名用户类&#10;class GuestUser extends User {}&#10;// 注册用户类&#10;class CustomerUser extends User {&#10;   function hasModifyPermission()&#10;   {&#10;   return true;&#10;   }&#10;}&#10;// 管理员类&#10;class AdminUser extends User {&#10;   function hasModifyPermission()&#10;   {&#10;   return true;&#10;   }&#10;   function hasDeletePermission()&#10;   {&#10;   return true;&#10;   }&#10;}&#10;/**&#10;* 用户 factory 类&#10;*/&#10;class UserFactory {&#10;   private static $users =    array("Andi"=&gt;"admin", "Hick"=&gt;"guest",&#10;   "Derick"=&gt;"customer");&#10;   static function Create($name)&#10;   {&#10;   if (!isset(self::$users[$name])) {&#10;   // 如果不存在对应的用户类，则提示错误&#10;   }&#10;   switch (self::$users[$name]) {&#10;   case "guest": return new GuestUser($name);&#10;   case "customer": return new CustomerUser($name);&#10;   case "admin": return new AdminUser($name);&#10;   default: // 默认应该报错&#10;   }&#10;   }&#10;}&#10;// 使用 factory 类实例化用户&#10;$HickUser = UserFactory::Create(‘Hick‘);&#10;echo $HickUser-&gt;name;&#10;?&gt;</description></item><item><title>[转]PHP 中实现 Singleton 模式和 Monostate 模式</title><link>https://hessian.cn/p/489.html</link><pubDate>Sat, 10 Nov 2007 19:49:00 +0800</pubDate><guid>https://hessian.cn/p/489.html</guid><description> 转自:http://blog.chinaunix.net/u/10599/showart_329555.html&#10;通常来说，类和对象(类的实例)之间是一对多的关系。但是某些情况下，我们只&#10;需要一个类的一个实例。比如多个实例的多样性反倒会带来一些不可控因素，多&#10;次的实例化，是一种资源的浪费，降低了效率；又如他们是工厂对象(factory&#10;object)，用来创建系统中的其他对象，等等。这时候，较好的处理方式就是让类&#10;的实例具有单一性：保障这个类在运行过程中最多生成一个实例( Singleton 模&#10;式)，或者让所有的实例保持一致( Monostate 模式)。&#10;PHP 下实现 Singleton 模式示例：&#10;&lt;?php&#10;class Singleton&#10;{&#10;   private static $instance;&#10;   private function __construct()&#10;   {&#10;   }&#10;   public static function instance()&#10;   {&#10;   if(self::$instance == null)&#10;   {&#10;   self::$instance = new Singleton();&#10;   }&#10;   return self::$instance;&#10;   }&#10;}&#10;?&gt; 创建 singleton 类实例就只能够是这样了：&#10;$instance = Singleton::instance();&#10;// 这样是错误的： $instance = new Singleton(); 详细分析一下 PHP 下实现的 singleton 模式的特征：&#10;1. 一个 static, private 属性：用来保存一个实例，static 保证类不被实例化&#10;也能够被类方法调用, private 保证它不被类的实例等改变。&#10;2. 一个 private 的构造方法：不允许该类在本类之外的地方实例化。&#10;3. 一个 static, public 方法：负责创建实例并保证其唯一性。static 使该方&#10;法可以不被实例化即可被调用。&#10;跟下面的 monostate 比，它的优点在于：&#10;1. 适应任何类，满足上面的三个特征即可。&#10;2. 可以统购派生创建，给定一个类，可以创建它的一个 singleton 子类。&#10;缺点：&#10;1. singleton 特性不能够被继承，其子类就不是 singleton 类了。&#10;2. 使用不通明，使用者必须知道它使用的是一个 singleton 类，而不能够通过&#10;new 来实例化。&#10;monostate 模式的基本原理就是让 monostate 类的所有实例使用起来是同一个实&#10;例一样。实际上把类的所有属性都使用 static 声明即可：&#10;&lt;?php class monostate {    private static $itsX = 0;       public function __construct()    {       }       public function setX($x)    {    self::$itsX = $x;    }       public function getX()    {    return self::$itsX;    } } ?&gt; 具体就不再详细介绍，其优缺点基本上刚好跟 singleton 模式相反。&#10;参考资料：《敏捷软件开发：原则、模式与实践》&#10;</description></item><item><title>[转]五种常见的PHP设计模式</title><link>https://hessian.cn/p/569.html</link><pubDate>Sat, 10 Nov 2007 19:14:00 +0800</pubDate><guid>https://hessian.cn/p/569.html</guid><description>转自:http://blog.csdn.net/kenwyn/archive/2007/03/26/1541443.aspx&#10;设计模式只是为 Java 架构师准备的 —— 至少您可能一直这样认为。实际上，设计模式对于每个人都非常有用。如果这些工具不是 “架构太空人” 的专利，那么它们又是什么？为什么说它们在 应用程序中非常有用？本文解释了这些问题。PHP&#10;</description></item><item><title>[转] 榨干 PHP，提高效率</title><link>https://hessian.cn/p/487.html</link><pubDate>Mon, 22 Oct 2007 00:56:00 +0800</pubDate><guid>https://hessian.cn/p/487.html</guid><description>原文地址：http://www.phpchina.com/bbs/thread-13409-1-1.html&#10;这篇杂文翻译整理自网络各路文档资料(见最末的参考资料)，尤其是 Ilia Alshanetsky (佩服之至) 在多个 PHP 会议上的演讲，主要是各类提高 PHP 性能的技巧。为求精准，很多部分都有详细的效率数据，以及对应的版本等等。偷懒，数据就不一一给出了，直接给结论，如果需要看原文档，请到文末「参考资料」部分。橙色标题为推荐部分。&#10;</description></item><item><title>[原创] 一个用来删除线性表重复元素的算法</title><link>https://hessian.cn/p/650.html</link><pubDate>Thu, 13 Sep 2007 22:48:00 +0800</pubDate><guid>https://hessian.cn/p/650.html</guid><description>由于我C不行,所以就用PHP来实现了,嘿嘿&#10;这个程序应该还可以再优化, 哪位高人给指点一下吧&#10;有线性表 L0,L1,L2 三个线性表&#10;要求将三个线性表中重复的元素删除,已知线性表的元素类型为 整型 且 按值的大小 升序排列&#10;</description></item><item><title>【转】为什么要 SET NAMES</title><link>https://hessian.cn/p/338.html</link><pubDate>Fri, 06 Jul 2007 22:45:00 +0800</pubDate><guid>https://hessian.cn/p/338.html</guid><description>大家都知道&#10;SET NAMES x&#10;相当于&#10;SET character_set_client = x;&#10;SET character_set_results = x;&#10;SET character_set_connection = x;&#10;以下从MySQL5.0官方文档上摘录了相关内容，并翻译，说明了相关系统变量的用处：&#10;</description></item><item><title>服务器变量：$_SERVER 详解</title><link>https://hessian.cn/p/405.html</link><pubDate>Thu, 14 Jun 2007 17:10:00 +0800</pubDate><guid>https://hessian.cn/p/405.html</guid><description>服务器变量：$_SERVER 其实这些东西手册里都有的，，，，，，，，，，，但我还是没事找事的放上来。。。我找抽吗？也许&#10;注: 在 PHP 4.1.0 及以后版本使用。之前的版本，使用 $HTTP_SERVER_VARS。 $_SERVER 是一个包含诸如头部(headers)、路径(paths)和脚本位置(script locations)的数组。数组的实体由 web 服务器创建。不能保证所有的服务器都能产生所有的信息；服务器可能忽略了一些信息，或者产生了一些未在下面列出的新的信息。这意味着，大量的这些变量在 CGI 1.1 specification 中说明，所以您应该仔细研究它。</description></item><item><title>patTemplate模板类的使用实例</title><link>https://hessian.cn/p/512.html</link><pubDate>Wed, 23 May 2007 17:51:00 +0800</pubDate><guid>https://hessian.cn/p/512.html</guid><description>&#10;前面讲了一个phplib的使用，作为模板驱动的代表patTemplate一样有着稳定，快速开发等等的优点，下面介绍一个简单实用的例子，我们使用test.php来解析模板test.html 并使用patTemplate作为模板引擎&#10;test.html 模板文件：&#10;&lt;patTemplate:tmpl name="article"&gt; &lt;html&gt; &lt;head&gt; &lt;title&gt;A patTemplate example&lt;/title&gt; &lt;/head&gt; &lt;body&gt; &lt;h3&gt;{HEADLINE}&lt;/h3&gt; {CONTENT} &lt;/body&gt; &lt;/html&gt; &lt;/patTemplate:tmpl&gt; 其中的变量headlinecontent是需要我们通过patTemplate来解析过来的&#10;test.php文件：&#10;&lt;?PHP //包含进模板类文件&#10;include("includes/patTemplate.php");  &#10;// 初始化模板对象&#10;$tmpl = new patTemplate();  &#10;// 设定模板文件目录&#10;$tmpl-&gt;setBasedir("templates");  &#10;// 设定使用的模板文件&#10;$tmpl-&gt;readTemplatesFromFile("example1.tmpl.html");  &#10;// 向模板添加变量&#10;$tmpl-&gt;addVar("article", "HEADLINE", "This is the headline"); $tmpl-&gt;addVar("article", "CONTENT", "And this is the content…");  &#10;// 最终解析并显示模板&#10;$tmpl-&gt;displayParsedTemplate("article"); ?&gt;   这是最简单的一个例子，当然如果你熟悉PHPLIB的话，那么也可以轻松的在patTemplate里面使用象PHPLIB一样的循环结构，后面再介绍吧</description></item><item><title>[原创]JOOMLA模板一例</title><link>https://hessian.cn/p/362.html</link><pubDate>Wed, 16 May 2007 14:10:00 +0800</pubDate><guid>https://hessian.cn/p/362.html</guid><description>body {&#10;margin: 0px;&#10;background:#666666 url(../images/bg.jpg) repeat-y scroll center;&#10;color:#cccc99;&#10;font-size:12px;&#10;font-family: Arial, PMingLiU, Sans-Serif;&#10;}&#10;a:link, a:visited {&#10;color:#cccc33;&#10;text-decoration: none;&#10;font-weight: normal;&#10;}&#10;a:hover{color:#ff6600;text-decoration: underline;}&#10;#wrap{&#10;margin:0 auto;&#10;}&#10;#header{&#10;min-height:90px;&#10;}&#10;#headercnt{&#10;position: relactive;&#10;top:10px;&#10;height:70px;&#10;overflow:hidden;&#10;}&#10;#mainbox{&#10;margin:0 auto;&#10;width:700px;&#10;}&#10;#logo {&#10;position: relactive;&#10;left: 0;&#10;top: 0;&#10;float: left;&#10;width: 200px;&#10;height: 75px;&#10;background: url(../images/jeek-logo.gif) 0 0 no-repeat;&#10;margin-left: 15px;&#10;margin-top: 5px;&#10;}&#10;#tabarea{&#10;margin:0 auto;&#10;width:100%;&#10;min-height:24px;&#10;background:url(../images/heading.gif);&#10;background-repeat:repeat-x;&#10;text-align: center;&#10;}&#10;#tabarea ul {&#10;margin: 0;&#10;padding: 0;&#10;list-style:none;&#10;}#tabarea li {&#10;float: left;&#10;padding:0;&#10;margin: 4px 0px 0px 15px;&#10;font-size:14px;&#10;}&#10;#tabarea li a{&#10;color:#ffff00;&#10;font-weight:bold;&#10;}&#10;#patharea{&#10;margin:0 auto;&#10;width:100%;&#10;min-height:22px;&#10;background-color:#333300;&#10;text-align: left;&#10;}&#10;#patharea .breadcrumbs{&#10;float:left;&#10;width:72%;&#10;margin-left:15px;&#10;}&#10;#pathRight{&#10;margin:0 auto;&#10;float:left;&#10;width:25%;&#10;background-color:#333300;&#10;text-align: left;&#10;}&#10;#pathRight #mod_search_searchword{&#10;font-size:12px;&#10;padding:0;&#10;margin:2px;&#10;color:#999999;&#10;background:#333300;&#10;width:140px;&#10;height:14px;&#10;border-top:solid 1px #666666;&#10;border-left:solid 1px #666666;&#10;border-right:solid 1px #cccccc;&#10;border-bottom:solid 1px #cccccc;&#10;}&#10;#pathRight .button{&#10;font-size:12px;&#10;padding:0;&#10;height:16px;&#10;margin:0px;&#10;color:#999999;&#10;background:#333300;&#10;border-top:solid 1px #cccccc;&#10;border-left:solid 1px #cccccc;&#10;border-right:solid 1px #666666;&#10;border-bottom:solid 1px #666666;&#10;}&#10;#bodybox{&#10;clear:both;&#10;}&#10;#leftcol{&#10;float:left;&#10;text-align:left;&#10;margin:0px;&#10;width:25%;&#10;}&#10;#leftcol table{&#10;margin:0 0 10px 10px;&#10;width:100%;&#10;text-align:left;&#10;}&#10;#mod_login_username,#mod_login_password{&#10;width:85%;&#10;height:14px;&#10;color:gray;&#10;border:dotted 1px;&#10;background:#663333;&#10;}&#10;#leftcol .poll{&#10;margin:0 0 10px 5px;&#10;width:100%;&#10;text-align:left;&#10;}&#10;#leftcol ul{&#10;margin:0;&#10;padding:0 0 10px 10px;&#10;list-style-position:inside;&#10;}&#10;#leftcol li{&#10;width:90%;&#10;height:14px;&#10;overflow:hidden;&#10;}&#10;#maincol{&#10;float:left;&#10;margin:0px;&#10;width:73%;&#10;min-height:600px;&#10;text-align:left;&#10;border-left:dashed 1px #999999;&#10;}&#10;#system-message{&#10;border:solid 4px #660000;&#10;background:yellow;&#10;color:red;&#10;font-weight:bold;&#10;padding-left:10px;&#10;}&#10;#bigbox{&#10;width:98%;&#10;margin-left:3px;&#10;float:left;&#10;}&#10;#boxtop{&#10;border-bottom:dashed 1px #999999;&#10;float:left;&#10;width:100%;&#10;}&#10;#boxtop ul{&#10;list-style-position:inside;&#10;margin:5px 0 5px 5px;&#10;padding:0 0 0 5px;&#10;}&#10;#boxtop li{&#10;width:90%;&#10;height:14px;&#10;overflow:hidden;&#10;}&#10;#boxtop_l{&#10;width:50%;&#10;padding-top:5px;&#10;float:left;&#10;}&#10;#boxtop_r{&#10;width:49%;&#10;padding-top:5px;&#10;float:left;&#10;border-left:dashed 1px #999999;&#10;}&#10;#boxmiddle{&#10;float:left;&#10;}&#10;.pagination span{&#10;margin-left:4px;&#10;}&#10;.pagination a{&#10;margin-left:4px;&#10;}&#10;#footer{&#10;color:gray;&#10;clear:both;&#10;border-top:solid 1px black;&#10;}&#10;#footer #line{&#10;width:100%;&#10;clear:both;&#10;height:15px;&#10;border-top:solid 1px #999999;&#10;}&#10;&lt;?php&#10;/**&#10;* @copyright Copyright (C) 2005 – 2007 Open Source Matters. All rights reserved.&#10;* @license GNU/GPL, see LICENSE.php&#10;* Joomla! is free software. This version may have been modified pursuant&#10;* to the GNU General Public License, and as distributed it includes or&#10;* is derivative of works licensed under the GNU General Public License or&#10;* other free or open source software licenses.&#10;* See COPYRIGHT.php for copyright notices and details.&#10;*/&#10;?&gt;&#10;&lt;!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN” “http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd”&gt;&#10;&lt;html xmlns=”http://www.w3.org/1999/xhtml” xml:lang=”&lt;?php echo $this-&gt;language; ?&gt;” lang=”&lt;?php echo $this-&gt;language; ?&gt;” &gt;&#10;&lt;head&gt;&#10;&lt;jdoc:include type=”head” /&gt;&#10;&lt;link href=”templates/&lt;?php echo $this-&gt;template ?&gt;/css/test.css” rel=”stylesheet” type=”text/css” /&gt;&#10;&lt;/head&gt;&#10;&lt;body&gt;&#10;&lt;div id=”top”&gt;&lt;/div&gt; &lt;!– 页面边框头部 –&gt;&#10;&lt;div id=”wrap” align=”center”&gt;&#10;&lt;div id=”mainbox”&gt;&#10;&lt;div id=”header”&gt;&#10;&lt;div id=”logo”&gt;&lt;/div&gt;&#10;&lt;div id=”headcnt”&gt;&#10;&lt;jdoc:include type=”modules” name=”headerContent” /&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&#10;&lt;div id=”tabarea” align=”center”&gt;&#10;&lt;div id=”navbar”&gt;&#10;&lt;jdoc:include type=”modules” name=”tabArea” /&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&#10;&lt;div id=”patharea”&gt;&#10;&lt;jdoc:include type=”modules” name=”pathArea” /&gt;&#10;&lt;div id=”pathRight”&gt;&#10;&lt;jdoc:include type=”modules” name=”pathRight” /&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&#10;&lt;div id=”bodybox”&gt;&#10;&lt;div id=”framehead”&gt;&lt;/div&gt; &lt;!– 正文部分边框头 –&gt;&#10;&lt;div id=”leftcol”&gt;&#10;&lt;jdoc:include type=”modules” name=”leftColum” /&gt;&#10;&lt;/div&gt;&#10;&lt;div id=”maincol”&gt;&#10;&lt;div id=”bigbox”&gt;&#10;&lt;jdoc:include type=”message” /&gt;&#10;&lt;?php if($this-&gt;countModules(‘boxTopLeft or boxTopRight’)): ?&gt;&#10;&lt;div id=”boxtop”&gt;&#10;&lt;?php if($this-&gt;countModules(‘boxTopLeft’)): ?&gt;&#10;&lt;div id=”boxtop_l”&gt;&lt;jdoc:include type=”modules” name=”boxTopLeft” /&gt;&lt;/div&gt;&#10;&lt;?php endif; ?&gt;&#10;&lt;?php if($this-&gt;countModules(‘boxTopRight’)): ?&gt;&#10;&lt;div id=”boxtop_r”&gt;&lt;jdoc:include type=”modules” name=”boxTopRight” /&gt;&lt;/div&gt;&#10;&lt;?php endif; ?&gt;&#10;&lt;/div&gt;&#10;&lt;?php endif; ?&gt;&#10;&lt;div id=”boxmiddle”&gt;&#10;&lt;jdoc:include type=”modules” name=”boxMiddle” /&gt;&#10;&lt;jdoc:include type=”component” /&gt;&#10;&lt;/div&gt;&#10;&lt;div id=”boxbottom”&gt;&lt;jdoc:include type=”modules” name=”boxBottom” /&gt;&lt;/div&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&#10;&lt;div id=”framefoot”&gt;&lt;/div&gt; &lt;!– 正文部分边框底部 –&gt;&#10;&lt;/div&gt;&#10;&lt;div id=”footer”&gt;&#10;&lt;div id=”line”&gt;&lt;/div&gt;&#10;&lt;jdoc:include type=”modules” name=”footer” /&gt;&#10;&lt;/div&gt;&lt;!– 底部 通常放版权信息的位置 –&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&#10;&lt;div id=”bottom”&gt;&lt;/div&gt; &lt;!– 页面边框底部 –&gt;&#10;&lt;/body&gt;&#10;&lt;/html&gt;&#10;</description></item><item><title>[原创] PDO 的简单使用</title><link>https://hessian.cn/p/590.html</link><pubDate>Sat, 12 May 2007 10:38:00 +0800</pubDate><guid>https://hessian.cn/p/590.html</guid><description>&lt;?php&#10;$hostname    =    "localhost";    //指定主机名&#10;$database    =    "db_book";        //指定数据库名称&#10;$usernmae    =    "root";            //指定用户名&#10;$password    =    "44444";    //指定密码&#10;$dsn = "mysql:dbname=" . $database . ";host=" . $hostname;&#10;//数据源描述&#10;try {&#10;    $conn    =    new PDO($dsn,$usernmae,$password);        //创建PDO对象 参数 : 数据源,用户名,密码&#10;}&#10;catch (PDOException $e) {&#10;    echo "Connecting failed: " . $e-&gt;getMessage();&#10;    //抛出异常&#10;}&#10;</description></item><item><title>PHP中的面向对象编程（OOP）</title><link>https://hessian.cn/p/393.html</link><pubDate>Fri, 11 May 2007 16:55:00 +0800</pubDate><guid>https://hessian.cn/p/393.html</guid><description>这里介绍了在PHP中的面向对象编程(OOP，Object Oriented Programming)。将向你演示如何通过使用一些OOP的概念和PHP的技巧来减少编码和提高质量。祝你好运！ 面向对象编程的概念： 不同的作者之间说法可能不一样，但是一个OOP语言必须有以下几方面：</description></item><item><title>[转]你对PHP6认识多少？</title><link>https://hessian.cn/p/503.html</link><pubDate>Thu, 10 May 2007 09:00:00 +0800</pubDate><guid>https://hessian.cn/p/503.html</guid><description> 去年在巴黎举行的PHP开发者大会中，PHP6开发的消息开始流传开来，&#10;于PHP大会讨论的PHP6，将有很大幅度的变化，但这只是草案阶段，&#10;并不代表所有会议的机率都会随着PHP6的发布而包含记录中所有的变更&#10;也就是说，在发布PHP6之前，还是会有异动的情形，但是可以确定的是&#10;下面所列的数项变化，将会随着PHP6一同面世（当然不是百分百乐，）&#10;赶快来看看这些新特性吧&#10;1.支持Unicode&#10;支持Unicode是有其必然，虽然Unicode占用较多的空间，但Unicode带来&#10;的便利性，远超过占用空间的缺点，尤其在国际化的今天，硬件设备越来&#10;越强大，网速也大幅度的提升，这么一点小小的缺点是可以忽略的。另外&#10;一点，PHP也可以在.ini文件中设定是否开启支持Unicode，决定权在你自己，&#10;这是一个不错的点子，关掉Unicode的支持，PHP的性能并不会有大幅度的&#10;提升，主要的影响在于需要引用字符串的函数。&#10;2.Register Globals 将被移除&#10;这是一个重要的决定，说多新进的PHP开发者会觉得Register Globals满&#10;方便的，但是却忽略了Register Globals会带来程序上安全性的隐患，大&#10;多数的主机上此项功能是关闭的，印象中从PHP4.3.x版开始时，此项默认&#10;设置值即是关闭状态，PHP6正式移除Register Globals也代表着如果程序&#10;是由PHP3时代的产物，将完全无法使用，除了改写一途外，别无他法。相&#10;信现在的PHP世界里，仍使用PHP3时代所产生的程序应该是少之又少。&#10;3.Magic Quotes 将消失&#10;Magic Quotes主要是自动转义需要转义的字符，此项功能移除叶符合大多&#10;数PHP开发者的心声。&#10;4.Safe Mode 取消&#10;老实说，这个模式不知道哪里不好，取消就取消吧，反正也用不到&#10;5.’var’ 别名为 ‘public’&#10;在类中的var声明变成public的别名，相信是为了兼容PHP5而作的决定，&#10;PHP6现在也可以称作为OO语言了。&#10;6.通过引用返回将出错&#10;现在透过引用返回编译器将会报错 例如$a =&amp; new b()、function &amp;c()，&#10;OO语言默认就是引用，所以不需要再使用&amp;了。&#10;7.zend.ze1 compatbility mode 将被移去&#10;Zend.ze1相容模式将被移去，PHP5是为兼容旧有PHP4，所以在.ini中可选择是否&#10;开启相容模式，原因在于PHP5使用的是第二代解析引擎，但是相容模式并不是百&#10;分之百能解析PHP4语法，所以旧时代的产物，移除。&#10;8.Freetype 1 and GD 1 support 将不见&#10;这两个是很久的Libs，所以不再支持，GD1早已被现在的GD2取代了。&#10;9.dl() 被移到 SAPI 中&#10;dl()主要是让设计师加载extension Libs，现在被移到 SAPI 中&#10;10.Register Long Array 去除&#10;从PHP5起默认是关闭，再PHP6中正式移除。&#10;11.一些Extension的变更&#10;例如 XMLReader 和 XMLWriter 将不再是以Extension的方式出现，他们将被移入&#10;到PHP的核心之中，并且默认是开启，ereg extension将被放入PECL，代表着它将&#10;被移出PHP核心，这也是为了让路给新的正则表达式extension，&#10;此外，Fileinfo extension 也将被导入PHP的核心之中。&#10;12.APC将被导入核心&#10;这是一个提高PHP性能的功能，现在它将被放入PHP核心中，并且可以选择是否启用APC&#10;13.告别ASP风格的起始标签&#10;原来是为了取悦ASP开发者转向使用PHP，现今已经不再需要这种做法了，&#10;最后，别期望PHP6的性能可以全面超过PHP5，有可能的是PHP6的执行效率会比&#10;PHP5还要来的慢的，但是可以预期的是，PHP开发小组将会努力的完善PHP5，超&#10;越PHP5。&#10;那么，对PHP6有兴趣的朋友现在可以到PHP官方网站上下载，试试这些功能是否真的已经&#10;在PHP6中体现出来了，下载地址http://snaps.php.net/</description></item><item><title>ASP,PHP与.NET伪造HTTP-REFERER方法及防止伪造REFERER方法探讨</title><link>https://hessian.cn/p/440.html</link><pubDate>Sat, 05 May 2007 14:53:00 +0800</pubDate><guid>https://hessian.cn/p/440.html</guid><description>HTTP-REFERER这个变量已经越来越不可靠了，完全就是可以伪造出来的东东。&#10;以下是伪造方法：&#10;ASP:&#10;dim http set http=server.createobject("MSXML2.XMLHTTP") ‘//MSXML2.serverXMLHTTP也可以&#10;Http.open "GET",url,false Http.setRequestHeader "Referer","http://www.dc9.cn/" Http.send()</description></item><item><title>PHP中的日期处理</title><link>https://hessian.cn/p/317.html</link><pubDate>Fri, 04 May 2007 21:08:00 +0800</pubDate><guid>https://hessian.cn/p/317.html</guid><description>by Allan Kent 我正打算用PHP编写一种帮助处理系统。我发现我必须知道处理完最后一位客户的问题后已经过去了多长时间？当我过去用ASP时解决这个问题相当简单，ASP有相应的函数DateDiff可以给出两个日期间间隔多少月、多少天和多少秒。当我搜寻完PHP手册后我发现PHP并没有类似的函数。</description></item><item><title>基于PHP的AJAX技术实现文件异步上传</title><link>https://hessian.cn/p/346.html</link><pubDate>Fri, 04 May 2007 20:54:00 +0800</pubDate><guid>https://hessian.cn/p/346.html</guid><description>　异步的文件上传是在现代的AJAX实现的Web应用里面经常要遇到，必须解决的问题。但是标准的AJAX类（XmlHttpRequest）无法实现传输文件的功能。因此，这里讨论的内容就是如何在AJAX的技术的基础之上构建异步的文件上传功能。在这个功能当中需要使用到内置的框及（IFRAME）来传输文件。这个功能实现的效果是页面在上传文件的时候，用户还可以使用该页面并且填写文件描述。</description></item><item><title>一个别人PHP的分页类</title><link>https://hessian.cn/p/410.html</link><pubDate>Fri, 04 May 2007 20:53:00 +0800</pubDate><guid>https://hessian.cn/p/410.html</guid><description>&lt;?&#10;/**&#10;* filename: ext_page.class.php&#10;* @package:phpbean&#10;* @author :feifengxlq&lt;feifengxlq#gmail.com&gt;&lt;[url=http://www.phpobject.net/]http://www.phpobject.net/[/url]&gt;&#10;* @copyright :Copyright 2006 feifengxlq&#10;* @license:version 2.0&#10;* @create:2006-5-31&#10;* @modify:2006-6-1&#10;* @modify:feifengxlq 2006-11-4&#10;* description:超强分页类，四种分页模式，默认采用类似baidu,google的分页风格。&#10;* 2.0增加功能：支持自定义风格，自定义样式，同时支持PHP4和PHP5,&#10;* to see detail,please visit [url=http://www.phpobject.net/blog/read.php]http://www.phpobject.net/blog/read.php[/url]?&#10;* example:&#10;* 模式四种分页模式：&#10;    require_once(‘../libs/classes/page.class.php’);&#10;    $page=new page(array(‘total’=&gt;1000,’perpage’=&gt;20));&#10;    echo ‘mode:1&lt;br&gt;’.$page-&gt;show();&#10;    echo ‘&lt;hr&gt;mode:2&lt;br&gt;’.$page-&gt;show(2);&#10;    echo ‘&lt;hr&gt;mode:3&lt;br&gt;’.$page-&gt;show(3);&#10;    echo ‘&lt;hr&gt;mode:4&lt;br&gt;’.$page-&gt;show(4);&#10;    开启AJAX：&#10;    $ajaxpage=new page(array(‘total’=&gt;1000,’perpage’=&gt;20,’ajax’=&gt;’ajax_page’,’page_name’=&gt;’test’));&#10;    echo ‘mode:1&lt;br&gt;’.$ajaxpage-&gt;show();&#10;    采用继承自定义分页显示模式：&#10;    demo:http://www.phpobject.net/blog&#10;*/&#10;class page {&#10;/**&#10;   * config ,public&#10;   */&#10;var $page_name=”PB_page”;//page标签，用来控制url页。比如说xxx.php?PB_page=2中的PB_page&#10;var $next_page=’&gt;’;//下一页&#10;var $pre_page='&lt;‘;//上一页&#10;var $first_page=’First’;//首页&#10;var $last_page=’Last’;//尾页&#10;var $pre_bar='&lt;&lt;‘;//上一分页条&#10;var $next_bar=’&gt;&gt;’;//下一分页条&#10;var $format_left='[‘;&#10;var $format_right=’]’;&#10;var $is_ajax=false;//是否支持AJAX分页模式</description></item><item><title>PHP V5.2 中的新增功能，第 2 部分: 使用新输入过滤扩展功能</title><link>https://hessian.cn/p/626.html</link><pubDate>Wed, 18 Apr 2007 02:11:00 +0800</pubDate><guid>https://hessian.cn/p/626.html</guid><description>2007 年 4 月 17 日&#10;在 “PHP V5.2 中的新增功能” 这一系列的第 2 部分中，了解如何有效使用新的 PHP V5.2 提供的新输入过滤扩展功能。这是一项急需的功能，它将允许您验证表单和其他输入介质的输入而无需依赖第三方软件。阅读本文后，您将能有效地过滤输入以提高应用程序的安全性。&#10;</description></item><item><title>PHP V5.2 中的新增功能，第 1 部分: 使用新的内存管理器</title><link>https://hessian.cn/p/490.html</link><pubDate>Wed, 18 Apr 2007 02:10:00 +0800</pubDate><guid>https://hessian.cn/p/490.html</guid><description>2007 年 4 月 10 日&#10;了解如何使用 PHP V5.2 中引入的新内存管理器并开始精通于跟踪和监视内存使用情况。这将使您可以在 PHP V5.2 中更加有效地使用更多的内存。&#10;PHP V5.2：开始&#10;</description></item></channel></rss>