在线
客服

在线客服
尊敬的客户,我们24小时竭诚为您服务 公司总机: 0755-83312037 (32条线)

客服
热线

0755-83312037 (32条线)
7*24小时客服服务热线

?

关注
微信

关注官方微信
TOP

返回
顶部

  • 13

    2019-04
    PHP6.0备受关注:让面向对象编程更加简单

    <p> </p> <table style="BORDER-RIGHT: #cccccc 1px dotted; TABLE-LAYOUT: fixed; BORDER-TOP: #cccccc 1px dotted; BORDER-LEFT: #cccccc 1px dotted; BORDER-BOTTOM: #cccccc 1px dotted" cellspacing="0" cellpadding="6" width="95%" align="center" border="0"><tbody><tr> <td style="WORD-WRAP: break-word" bgcolor="#fdfddf"> <font color="#ff0000">WebjxCom提示:</font><font color="#000000">传PHP 6.0即将发布,包含很多新特性与语法.</font> </td> </tr></tbody></table> PHP 6.0将包含很多新的特性、语法改进,会让面向对象编程更加简单,另外还有很多重要的改进,比如Unicode的核心支持,这将让PHP更适合全球范围支 持和更加的健康发展。 <p>PHP下一个备受关注的版本6.0,已经进入snapshot阶段,不久即将发布。PHP 6.0将包含很多新的特性、语法改进,会让面向对象编程更加简单,另外还有很多重要的改进,比如Unicode的核心支持,这将让PHP更适合全球范围支 持和更加的健康发展。PHP是已经风靡全球的开源脚本语言,在数以万计的网站上运行着,PHP 6.0将完全向前兼容,同时增加许多令人激动的特性。 </p> <p>更加好的Unicode支持<br>NameSpace:名字空间,将更好的避免在函数及类之间的变量名冲突。<br>令人激动的Web 2.0特性<br>SOAP: 简单对象访问协议 (SOAP:Simple Object Access Protocol)SOAP 可以和现存的许多因特网协议和格式结合使用,包括超文本传输协议( HTTP),简单邮件传输协议(SMTP),多用途网际邮件扩充协议(MIME)。它还支持从消息系统到远程过程调用(RPC)等大量的应用程序。<br>XML:从PHP 5.1版本开始,XMLReader和XMLWriter就已经包含在PHP内核,它可以让它可以让XML编程更加轻松。</p> <p>当然,除了增加新的特性,一些会给系统带来不稳定因素和安全隐患的特性也将被取消,以下是取消的内容列表:</p> <p>magic_quotes<br>register_globals<br>register_long_arrays<br>safe_mode<br>magic_quotes<br></p>

    Read more +
  • 13

    2019-04
    PHP开发技巧:PHP网站发开实用技巧集锦

    <p> </p> <table style="BORDER-RIGHT: #cccccc 1px dotted; TABLE-LAYOUT: fixed; BORDER-TOP: #cccccc 1px dotted; BORDER-LEFT: #cccccc 1px dotted; BORDER-BOTTOM: #cccccc 1px dotted" cellspacing="0" cellpadding="6" width="95%" align="center" border="0"><tbody><tr> <td style="WORD-WRAP: break-word" bgcolor="#fdfddf"> <font color="#ff0000">WebjxCom提示:</font><font color="#000000">提高PHP开发效率的53个编程技巧.</font> </td> </tr></tbody></table> <p>用单引号代替双引号来包含字符串,这样做会更快一些。因为PHP会在双引号包围的字符串中搜寻变量,单引号则不会,注意:只有echo能这么做,它是一种可以把多个字符串当作参数的“函数”(译注:PHP手册中说echo是语言结构,不是真正的函数,故把函数加上了双引号)。</p> <p>1、如果能将类的方法定义成static,就尽量定义成static,它的速度会提升将近4倍。</p> <p>2、$row[’id’] 的速度是$row[id]的7倍。</p> <p>3、echo 比 print 快,并且使用echo的多重参数(译注:指用逗号而不是句点)代替字符串连接,比如echo $str1,$str2。</p> <p>4、在执行for循环之前确定最大循环数,不要每循环一次都计算最大值,最好运用foreach代替。</p> <p>5、注销那些不用的变量尤其是大数组,以便释放内存。</p> <p>6、尽量避免使用__get,__set,__autoload。</p> <p>7、require_once()代价昂贵。</p> <p>8、include文件时尽量使用绝对路径,因为它避免了PHP去include_path里查找文件的速度,解析操作系统路径所需的时间会更少。</p> <p>9、如果你想知道脚本开始执行(译注:即服务器端收到客户端请求)的时刻,使用$_SERVER[‘REQUEST_TIME’]要好于time()。</p> <p>10、函数代替正则表达式完成相同功能。</p> <p>11、str_replace函数比preg_replace函数快,但strtr函数的效率是str_replace函数的四倍。</p> <p>12、如果一个字符串替换函数,可接受数组或字符作为参数,并且参数长度不太长,那么可以考虑额外写一段替换代码,使得每次传递参数是一个字符,而不是只写一行代码接受数组作为查询和替换的参数。</p> <p>13、使用选择分支语句(译注:即switch case)好于使用多个if,else if语句。</p> <p>14、用@屏蔽错误消息的做法非常低效,极其低效。</p> <p>15、打开apache的mod_deflate模块,可以提高网页的浏览速度。</p> <p>16、数据库连接当使用完毕时应关掉,不要用长连接。</p> <p>17、错误消息代价昂贵。</p> <p>18、在方法中递增局部变量,速度是最快的。几乎与在函数中调用局部变量的速度相当。</p> <p>19、递增一个全局变量要比递增一个局部变量慢2倍。</p> <p>20、递增一个对象属性(如:$this-&gt;prop++)要比递增一个局部变量慢3倍。</p> <p>21、递增一个未预定义的局部变量要比递增一个预定义的局部变量慢9至10倍。</p> <p>22、仅定义一个局部变量而没在函数中调用它,同样会减慢速度(其程度相当于递增一个局部变量)。PHP大概会检查看是否存在全局变量。</p> <p>用单引号代替双引号来包含字符串,这样做会更快一些。因为PHP会在双引号包围的字符串中搜寻变量,单引号则不会,注意:只有echo能这么做,它是一种可以把多个字符串当作参数的“函数”(译注:PHP手册中说echo是语言结构,不是真正的函数,故把函数加上了双引号)。</p> <p>1、如果能将类的方法定义成static,就尽量定义成static,它的速度会提升将近4倍。</p> <p>2、$row[’id’] 的速度是$row[id]的7倍。</p> <p>3、echo 比 print 快,并且使用echo的多重参数(译注:指用逗号而不是句点)代替字符串连接,比如echo $str1,$str2。</p> <p>4、在执行for循环之前确定最大循环数,不要每循环一次都计算最大值,最好运用foreach代替。</p> <p>5、注销那些不用的变量尤其是大数组,以便释放内存。</p> <p>6、尽量避免使用__get,__set,__autoload。</p> <p>7、require_once()代价昂贵。</p> <p>8、include文件时尽量使用绝对路径,因为它避免了PHP去include_path里查找文件的速度,解析操作系统路径所需的时间会更少。</p> <p>9、如果你想知道脚本开始执行(译注:即服务器端收到客户端请求)的时刻,使用$_SERVER[‘REQUEST_TIME’]要好于time()。</p> <p>10、函数代替正则表达式完成相同功能。</p> <p>11、str_replace函数比preg_replace函数快,但strtr函数的效率是str_replace函数的四倍。</p> <p>12、如果一个字符串替换函数,可接受数组或字符作为参数,并且参数长度不太长,那么可以考虑额外写一段替换代码,使得每次传递参数是一个字符,而不是只写一行代码接受数组作为查询和替换的参数。</p> <p>13、使用选择分支语句(译注:即switch case)好于使用多个if,else if语句。</p> <p>14、用@屏蔽错误消息的做法非常低效,极其低效。</p> <p>15、打开apache的mod_deflate模块,可以提高网页的浏览速度。</p> <p>16、数据库连接当使用完毕时应关掉,不要用长连接。</p> <p>17、错误消息代价昂贵。</p> <p>18、在方法中递增局部变量,速度是最快的。几乎与在函数中调用局部变量的速度相当。</p> <p>19、递增一个全局变量要比递增一个局部变量慢2倍。</p> <p>20、递增一个对象属性(如:$this-&gt;prop++)要比递增一个局部变量慢3倍。</p> <p>21、递增一个未预定义的局部变量要比递增一个预定义的局部变量慢9至10倍。</p> <p>22、仅定义一个局部变量而没在函数中调用它,同样会减慢速度(其程度相当于递增一个局部变量)。PHP大概会检查看是否存在全局变量。</p> <p>&#160;</p> <table style="BORDER-BOTTOM: #cccccc 1px dotted; BORDER-LEFT: #cccccc 1px dotted; TABLE-LAYOUT: fixed; BORDER-TOP: #cccccc 1px dotted; BORDER-RIGHT: #cccccc 1px dotted" border="0" cellspacing="0" cellpadding="6" width="95%" align="center"><tbody><tr> <td style="WORD-WRAP: break-word" bgcolor="#fdfddf">if (strlen($foo) &lt; 5) { echo “Foo is too short”$$ }</td> </tr></tbody></table> <p>&#160;</p> <p>(与下面的技巧做比较)</p> <p>&#160;</p> <table style="BORDER-BOTTOM: #cccccc 1px dotted; BORDER-LEFT: #cccccc 1px dotted; TABLE-LAYOUT: fixed; BORDER-TOP: #cccccc 1px dotted; BORDER-RIGHT: #cccccc 1px dotted" border="0" cellspacing="0" cellpadding="6" width="95%" align="center"><tbody><tr> <td style="WORD-WRAP: break-word" bgcolor="#fdfddf">if (!isset($foo{5})) { echo “Foo is too short”$$ }</td> </tr></tbody></table> <p>&#160;</p> <p>调用isset()恰巧比strlen()快,因为与后者不同的是,isset()作为一种语言结构,意味着它的执行不需要函数查找和字母小写化。也就是说,实际上在检验字符串长度的顶层代码中你没有花太多开销。</p> <p>34、当执行变量$i的递增或递减时,$i++会比++$i慢一些。这种差异是PHP特有的,并不适用于其他语言,所以请不要修改你的C或Java代码并指望它们能立即变快,没用的。++$i更快是因为它只需要3条指令(opcodes),$i++则需要4条指令。后置递增实际上会产生一个临时变量,这个临时变量随后被递增。而前置递增直接在原值上递增。这是最优化处理的一种,正如Zend的PHP优化器所作的那样。牢记这个优化处理不失为一个好主意,因为并不是所有的指令优化器都会做同样的优化处理,并且存在大量没有装配指令优化器的互联网服务提供商(ISPs)和服务器。</p> <p>35、并不是事必面向对象(OOP),面向对象往往开销很大,每个方法和对象调用都会消耗很多内存。</p> <p>36、并非要用类实现所有的数据结构,数组也很有用。</p> <p>37、不要把方法细分得过多,仔细想想你真正打算重用的是哪些代码?</p> <p>38、当你需要时,你总能把代码分解成方法。</p> <p>39、尽量采用大量的PHP内置函数。</p> <p>40、如果在代码中存在大量耗时的函数,你可以考虑用C扩展的方式实现它们。<br>41、评估检验(profile)你的代码。检验器会告诉你,代码的哪些部分消耗了多少时间。Xdebug调试器包含了检验程序,评估检验总体上可以显示出代码的瓶颈。<br>42、mod_zip可作为Apache模块,用来即时压缩你的数据,并可让数据传输量降低80%。</p> <p>43、在可以用file_get_contents替代file、fopen、feof、fgets等系列方法的情况下,尽量用file_get_contents,因为他的效率高得多!但是要注意file_get_contents在打开一个URL文件时候的PHP版本问题;</p> <p>44、尽量的少进行文件操作,虽然PHP的文件操作效率也不低的;</p> <p>45、优化Select SQL语句,在可能的情况下尽量少的进行Insert、Update操作(在update上,我被恶批过);</p> <p>46、尽可能的使用PHP内部函数(但是我却为了找个PHP里面不存在的函数,浪费了本可以写出一个自定义函数的时间,经验问题啊!);</p> <p>47、循环内部不要声明变量,尤其是大变量:对象(这好像不只是PHP里面要注意的问题吧?);</p> <p>48、多维数组尽量不要循环嵌套赋值;</p> <p>49、在可以用PHP内部字符串操作函数的情况下,不要用正则表达式;</p> <p>50、foreach效率更高,尽量用foreach代替while和for循环;</p> <p>51、用单引号替代双引号引用字符串;</p> <p>52、“用i+=1代替i=i+1。符合c/c++的习惯,效率还高”;</p> <p>53、对global变量,应该用完就unset()掉;</p>

    Read more +
  • 13

    2019-04
    Windows7系统环境安装配置PHP开发环境

    <p> </p> <table style="BORDER-RIGHT: #cccccc 1px dotted; TABLE-LAYOUT: fixed; BORDER-TOP: #cccccc 1px dotted; BORDER-LEFT: #cccccc 1px dotted; BORDER-BOTTOM: #cccccc 1px dotted" cellspacing="0" cellpadding="6" width="95%" align="center" border="0"><tbody><tr> <td style="WORD-WRAP: break-word" bgcolor="#fdfddf"> <font color="#ff0000">WebjxCom提示:</font><font color="#000000">Windows7系统环境安装配置PHP开发环境.</font> </td> </tr></tbody></table> <strong>一、Apache安装<br></strong>版本解释:openssl是表示带有openssl模块,利用openssl就可以给Apache配置SSL安全链接的,也就是使用https://方式进行访问。<br>     nossl则表示不带OpenSSL模块,无 法用于SSL安全链接,在这里我们下载带OpenSSL的。<br>选择版本:apache_2.2.14-win32-x86-openssl-0.9.8k.msi<br>下载地址:<a href="http://www.apache.org/dist/httpd/binaries/win32/"><font color="#0179a5">http://www.apache.org/dist/httpd/binaries/win32/</font></a> <p>首先我们在D盘(盘符根据实际情况自己选择)新建一个目录,<br>并且命名为“WAMP”其意义为“Wdindows Apache Mysql PhpMyAdmin” 之后安装的一些内容,也都将安装在该目录下。</p> <p>1.安装说明:<br>运行apache安装程序,方法非常简单,弹安装界面后一直“next”</p> <p>接着会出现一个界面,需要填写3个内容,分别为:Network Domain、Server Name、Administrator’s Email Address 随便填写就好,不影响内容。<br>在下面还有2个选项,默认选择为80端口,第二个为8080端口,根据个人需求选择,一般为默认80端口。<br>我们继续安装,选择Custom(自定义安装)-“next”</p> <p>其中有打着红X的组件,我们单击这个组件容,选择“This feature, and all subfeatures, will be installed on local hard drive.”,即“此部分,及下属子部分内容,全部安装在本地硬盘上”。-“next”</p> <p>然后选择右下角的“change ”改变安装路径,安装到刚才建立的目录中“D:\WAMP\Apache\”-“next”<br>安装完毕后,电脑右下角会多出一个图标,双击打开,选择start或restart,能正常运行,至此安装完毕。</p> <p>2.修改配置:<br>打开安装录下D:\WAMP\Apache\conf\httpd.conf 文件(修改配置文件时,不建议使用记事本,可能会对其造成影响,推荐使用Notepad++或其他编辑软件打开修改)</p> <p>打开以后Ctrl+F查找所要修改的内容</p> <p>在#LoadModule vhost_alias_module modules/mod_vhost_alias.so下添加:<br>LoadModule php5_module “D:/WAMP/PHP/php5apache2_2.dll”<br>PHPIniDir “D:/WAMP/PHP”<br>AddType application/x-httpd-php .php<br>AddType application/x-httpd-php .htm<br>AddType application/x-httpd-php .html</p> <p>DocumentRoot “E:/WAMP/Apache/htdocs”<br>修改成(这里的路径和IIS中wwwroot目录一样,用于存放网页,自定义或不做修改默认):DocumentRoot “D:/WAMP/www”</p> <p>&lt;Directory “E:/WAMP/Apache/htdocs”&gt;<br>修改成(自定义或不做修改默认):&lt;Directory “D:/WAMP/www”&gt;</p> <p>DirectoryIndex index.html<br>修改成:DirectoryIndex index.php default.php index.html index.htm default.html default.htm</p> <p>3.测试<br>在D:/WAMP/www目录下 建立个index.html页面<br>在浏览器中输入 <a href="http://localhost/"><font color="#0179a5">http://localhost/</font></a><br>如果能正常显示,Apache配置完毕,已经正常运行。</p> <p><strong>二、MySql安装</strong><br>版本解释:The Essentials Package:不包含 embedded server and benchmark suite,有自动安装程序和配置向导,没有MySQL Documentation。<br>     The Complete Package:包含 embedded server and benchmark suite,有自动安装程序和配置向导,有MySQL Documentation。<br>     The Noinstall Archive:包含 embedded server and benchmark suite,没有自动安装程序和配置向导,有MySQL Documentation。<br>选择版本:mysql-essential-5.1.44-win32.msi<br>下载地址:<a href="http://www.mysql.com/downloads/mysql/"><font color="#0179a5">http://www.mysql.com/downloads/mysql/</font></a></p> <p>1.安装说明:<br>打开安装程序,单击“next”<br>选择custom,组件为默认选择,我们不做改动-“next”</p> <p>路径设置为“D:\WAMP\Mysql”-“next”</p> <p>安装好以后点击“finish”<br>跟着会出现一个配置向导-“next”</p> <p>选择“Detailed Configuration(详细配置)”-“next”</p> <p>这里有3个选项:<br>Developer Machine,将只用尽量少的内存;<br>Server Machine,将使用中等数量内存;<br>Dedicated MySQL Server Machine,这台服务器上面只跑mysql数据库,将占用全部的内存。<br>可以根据自己需求选择,这里我们选择第二种“Server Machine”-“next”</p> <p>选择数据库用途,同样有3个选项:<br>Mutltifunctional Database多功能用途,将把数据库优化成很好的innodb存储类型和高效率的myisam存储类型;<br>Transactional Database Only只用于事务处理类型,最好的优化innodb,但同时也支持myisam;<br>Non-Transactional Databse Only非事务处理类型,适合于简单的应用,只有不支持事务的myisam类型是被支持的。<br>一般选择第一种多功能的,同样我们也是。-“next”</p> <p>选择InnodDB的数据存放位置,一般默认就行,为了统一我填写了“WAMP/MySQL Datafiles”-“next”</p> <p>选择mysql允许的最大连接数,第一种是最大20个连接并发数,第二种是最大500个并发连接数,最后一种是自定义,自己可以根据需求选择,我选择第二个-“next”</p> <p>下面是选择数据库监听的端口,一般默认是3306,如果改成其他端口,以后连接数据库的时候都要记住修改的端口,否则不能连接mysql数据库,比较麻烦,这里不做修改,用mysq的默认端口:3306-“next”</p> <p>这一步设置mysql的默认编码,我们选择第三个,并在Character Set菜单中,选择“gbk”编码-“next”<br>(注:如果要用原来数据库的数据,最好能确定原来数据库用的是什么编码,如果这里设置的编码和原来数据库数据的编码不一致,在使用的时候可能会出现乱码。)</p> <p>这一步是是否要把mysql设置成windows的,一般选择设成服务,这样以后就可以通过服务中启动和关闭mysql数据库。下面的复选框也勾选上,这样,在cmd模式下,不必非到mysql的bin目录下执行命令。也就是把上下2个勾都打上,中间默认-“next”</p> <p>这一步是设置mysql的超级用户密码,这个超级用户非常重要,对mysql拥有全部的权限,请设置好并牢记超级用户的密码,下面有个复选框是选择是否允许远程机器用root用户连接到你的mysql服务器上面,如果有这个需求,也请勾选。这里我们使用默认选择,在New root password和Confirm中输入密码。“next”</p> <p>点击“execute”进行配置,稍微等待一会,圆点上的勾全部打上,就代表配置完毕。</p> <p>2.修改配置:<br>打开D:\WAMP\MySQL\my.ini<br>设置datadir为D:/WAMP/MySQL/data/或你所要存放数据位置的目录即可。</p> <p><strong>三、PHP安装<br></strong>版本解释:VC9 专门为IIS定值的脚本,使用Visual Studio 2008编译器编译,支持最新的微软组建,从而提高效率。<br>     VC6 是为了其他WEB服务软件提供的脚本 如 Apache。<br>     Thread Safe 现成安全,之星时会进行线程 安全检查,以防止有心要求就启动新线程(Thread)的CGI执行方式而耗尽系统资源。<br>     Non Thread Safe是非线程安全,在执行时不进行线程(Thread)安全检查<br>选择版本:PHP5.3(5.3.1)中VC6 x86 Thread Safe下&#160;ZIP下载<br>下载地址:<a href="http://windows.php.net/download/"><font color="#0179a5">http://windows.php.net/download/</font></a></p> <p>1.安装说明<br>由于我们下载的的是ZIP压缩包,只需要将文件解压到“D:\WAMP\PHP”目录下即可</p> <p>2.修改配置<br>将E:\WAMP\PHP\php.ini-development 文件修改成php.ini<br>打开php.ini</p> <p>; extension_dir = “ext”<br>修改成:extension_dir = “E:\WAMP\PHP\ext”</p> <p>将947行下,这些文件前面的“;”去除<br>extension=php_curl.dll<br>extension=php_gd2.dll<br>extension=php_mbstring.dll<br>extension=php_mysql.dll<br>extension=php_mysqli.dll<br>extension=php_pdo_mysql.dll<br>extension=php_xmlrpc.dll</p> <p>;date.timezone =<br>修改成(很多网站没提到这里要修改,默认为美国时间,如果不修改会报错):date.timezone = Asia/Shanghai</p> <p>3.测试<br>重启Apache(修改过配置文件 必须重启Apache才会生效)<br>新建个index.php 页面,代码中输入&lt;?php phpinfo();?&gt;,保存文件放到“D:\WMAP\www\”目录下<br>打开浏览器输入:<a href="http://localhost/index.php"><font color="#0179a5">http://localhost/index.php</font></a> 如果能正常显示,说明PHP配置完毕,可以查看该页面的PHP信息是否正确。<br>(注:&lt;?php phpinfo();?&gt;在改文件中输入函数可输出大量的有关<em>PHP</em>当前状态的信息,如<em>PHP</em>版本,服务器信息和环境等。)<br>(注:)</p> <p>接着我们测试下,是否能连接到Mysql<br>再新建个link.php,下代码中输入<br>&lt;?php<br>$link=mysql_connect(“127.0.0.1″,”root”,”Mysql安装时填写的密码”);<br>if(!$link) echo “Mysql数据库连接失败!”;<br>else echo “Mysql数据库连接成功!”;<br>mysql_close();<br>?&gt;<br>也保存文件放到“D:\WMAP\www\”目录下<br>打开浏览器输入:<a href="http://localhost/index.php"><font color="#0179a5">http://localhost/link.php</font></a>&#160;查看</p> <p><strong>四、PhpMyAdmin安装</strong><br>版本解释:phpMyAdmin-3.2.5<br>选择版本:phpMyAdmin-3.2.5-all-languages.zip<br>下载地址:<a href="http://www.phpmyadmin.net/home_page/downloads.php"><font color="#0179a5">http://www.phpmyadmin.net/home_page/downloads.php</font></a></p> <p>1.安装说明<br>解压到D:\WAMP\phpMyAdmin</p> <p>2.修改配置<br>打开D:\WAMP\phpMyAdmin\libraries\config.default.php</p> <p>$cfg['PmaAbsoluteUri'] = ”;<br>修改成(填写访问phpMyAdmin的绝对URL):$cfg['PmaAbsoluteUri'] = ‘http://localhost/PHPMyadmin/’;</p> <p>$cfg['Servers'][$i]['host'] = ‘localhost’;<br>修改成(填写服务器地址,通常默认,不需要修改):$cfg['Servers'][$i]['host'] = ‘localhost’;</p> <p>$cfg['Servers'][$i]['user'] = ‘root’;<br>修改成(填写Mysql用户名,这里我们默认):$cfg['Servers'][$i]['user'] = ‘root’;</p> <p>$cfg['Servers'][$i]['password'] = ”;<br>修改成(填写Mysql密码):$cfg['Servers'][$i]['password'] = ‘Mysql PWD;</p> <p>$cfg['Servers'][$i]['auth_type'] = ‘cookie’;<br>修改成(设置认证方法,安全因素考虑,填写成cookie):$cfg['Servers'][$i]['auth_type'] = ‘cookie’;</p> <p>$cfg['blowfish_secret'] = ”;<br>修改成(设置短语密码,如果上面设置成cookie,那这里不能留空,不然登陆会提示错误):$cfg['blowfish_secret'] = ‘cookie’;</p> <p>3.测试<br>打开浏览器输入:<a href="http://localhost/phpmyadmin/"><font color="#0179a5">http://localhost/phpmyadmin/</font></a>&#160;访问和登陆</p> <p><strong>五、结尾<br></strong>至此Windows7下的PHP环境搭建完毕,大家尽情的使用吧。</p>

    Read more +
  • 13

    2019-04
    PHP开发应用程序:生成随机字符串的方法

    <p> </p> <table style="BORDER-RIGHT: #cccccc 1px dotted; TABLE-LAYOUT: fixed; BORDER-TOP: #cccccc 1px dotted; BORDER-LEFT: #cccccc 1px dotted; BORDER-BOTTOM: #cccccc 1px dotted" cellspacing="0" cellpadding="6" width="95%" align="center" border="0"><tbody><tr> <td style="WORD-WRAP: break-word" bgcolor="#fdfddf"> <font color="#ff0000">WebjxCom提示:</font><font color="#000000">PHP生成随机密码的三种方法.</font> </td> </tr></tbody></table> <p>使用<strong>PHP</strong>开发应用程序,尤其是网站程序,常常需要<strong>生成随机密码</strong>,如用户注册生成随机密码,用户重置密码也需要生成一个随机的密码。随机密码也就是一串固定长度的字符串,这里我收集整理了几种生成随机字符串的方法,以供大家参考。</p> <p><strong>方法一</strong>:</p> <p>1、在 33 &#8211; 126 中生成一个随机整数,如 35,</p> <p>2、将 35 转换成对应的ASCII码字符,如 35 对应 #</p> <p>3、重复以上 1、2 步骤 n 次,连接成 n 位的密码</p> <p>该算法主要用到了两个函数,mt_rand ( int $min , int $max )函数用于生成随机整数,其中 $min &#8211; $max 为 ASCII 码的范围,这里取 33 -126 ,可以根据需要调整范围,如ASCII码表中 97 &#8211; 122 位对应 a &#8211; z 的英文字母,具体可参考 ASCII码表; chr ( int $ascii )函数用于将对应整数 $ascii 转换成对应的字符。</p> <p> </p> <table style="BORDER-RIGHT: #cccccc 1px dotted; TABLE-LAYOUT: fixed; BORDER-TOP: #cccccc 1px dotted; BORDER-LEFT: #cccccc 1px dotted; BORDER-BOTTOM: #cccccc 1px dotted" cellspacing="0" cellpadding="6" width="95%" align="center" border="0"><tbody><tr> <td style="WORD-WRAP: break-word" bgcolor="#fdfddf"> <p>function create_password($pw_length = 8)<br>{<br>&#160;&#160;&#160; $randpwd = '';<br>&#160;&#160;&#160; for ($i = 0; $i &lt; $pw_length; $i++) <br>&#160;&#160;&#160; {<br>&#160;&#160;&#160;&#160;&#160;&#160;&#160; $randpwd .= chr(mt_rand(33, 126));<br>&#160;&#160;&#160; }<br>&#160;&#160;&#160; return $randpwd;<br>}</p> <p>// 调用该函数,传递长度参数$pw_length = 6<br>echo create_password(6);</p> </td> </tr></tbody></table> <p><strong>方法二</strong>:</p> <p>1、预置一个的字符串 $chars ,包括 a &#8211; z,A &#8211; Z,0 &#8211; 9,以及一些特殊字符</p> <p>2、在 $chars 字符串中随机取一个字符</p> <p>3、重复第二步 n 次,可得长度为 n 的密码</p> <p> </p> <table style="BORDER-RIGHT: #cccccc 1px dotted; TABLE-LAYOUT: fixed; BORDER-TOP: #cccccc 1px dotted; BORDER-LEFT: #cccccc 1px dotted; BORDER-BOTTOM: #cccccc 1px dotted" cellspacing="0" cellpadding="6" width="95%" align="center" border="0"><tbody><tr> <td style="WORD-WRAP: break-word" bgcolor="#fdfddf"> <p>function generate_password( $length = 8 ) {<br>&#160;&#160;&#160; // 密码字符集,可任意添加你需要的字符<br>&#160;&#160;&#160; $chars = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@#$%^&amp;*()-_ []{}&lt;&gt;~`+=,.;:/?|';</p> <p>&#160;&#160;&#160; $password = '';<br>&#160;&#160;&#160; for ( $i = 0; $i &lt; $length; $i++ ) <br>&#160;&#160;&#160; {<br>&#160;&#160;&#160;&#160;&#160;&#160;&#160; // 这里提供两种字符获取方式<br>&#160;&#160;&#160;&#160;&#160;&#160;&#160; // 第一种是使用 substr 截取$chars中的任意一位字符;<br>&#160;&#160;&#160;&#160;&#160;&#160;&#160; // 第二种是取字符数组 $chars 的任意元素<br>&#160;&#160;&#160;&#160;&#160;&#160;&#160; // $password .= substr($chars, mt_rand(0, strlen($chars) - 1), 1);<br>&#160;&#160;&#160;&#160;&#160;&#160;&#160; $password .= $chars[ mt_rand(0, strlen($chars) - 1) ];<br>&#160;&#160;&#160; }</p> <p>&#160;&#160;&#160; return $password;<br>}</p> </td> </tr></tbody></table> <p>function generate_password( $length = 8 ) {<br>&#160;&#160;&#160; // 密码字符集,可任意添加你需要的字符<br>&#160;&#160;&#160; $chars = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@#$%^&amp;*()-_ []{}&lt;&gt;~`+=,.;:/?|';</p> <p>&#160;&#160;&#160; $password = '';<br>&#160;&#160;&#160; for ( $i = 0; $i &lt; $length; $i++ ) <br>&#160;&#160;&#160; {<br>&#160;&#160;&#160;&#160;&#160;&#160;&#160; // 这里提供两种字符获取方式<br>&#160;&#160;&#160;&#160;&#160;&#160;&#160; // 第一种是使用 substr 截取$chars中的任意一位字符;<br>&#160;&#160;&#160;&#160;&#160;&#160;&#160; // 第二种是取字符数组 $chars 的任意元素<br>&#160;&#160;&#160;&#160;&#160;&#160;&#160; // $password .= substr($chars, mt_rand(0, strlen($chars) - 1), 1);<br>&#160;&#160;&#160;&#160;&#160;&#160;&#160; $password .= $chars[ mt_rand(0, strlen($chars) - 1) ];<br>&#160;&#160;&#160; }</p> <p>&#160;&#160;&#160; return $password;<br>}</p> <p> </p> <table style="BORDER-RIGHT: #cccccc 1px dotted; TABLE-LAYOUT: fixed; BORDER-TOP: #cccccc 1px dotted; BORDER-LEFT: #cccccc 1px dotted; BORDER-BOTTOM: #cccccc 1px dotted" cellspacing="0" cellpadding="6" width="95%" align="center" border="0"><tbody><tr> <td style="WORD-WRAP: break-word" bgcolor="#fdfddf"> <p>function make_password( $length = 8 )<br>{<br>&#160;&#160;&#160; // 密码字符集,可任意添加你需要的字符<br>&#160;&#160;&#160; $chars = array('a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', <br>&#160;&#160;&#160; 'i', 'j', 'k', 'l','m', 'n', 'o', 'p', 'q', 'r', 's', <br>&#160;&#160;&#160; 't', 'u', 'v', 'w', 'x', 'y','z', 'A', 'B', 'C', 'D', <br>&#160;&#160;&#160; 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L','M', 'N', 'O', <br>&#160;&#160;&#160; 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y','Z', <br>&#160;&#160;&#160; '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '!', <br>&#160;&#160;&#160; '@','#', '$', '%', '^', '&amp;', '*', '(', ')', '-', '_', <br>&#160;&#160;&#160; '[', ']', '{', '}', '&lt;', '&gt;', '~', '`', '+', '=', ',', <br>&#160;&#160;&#160; '.', ';', ':', '/', '?', '|');</p> <p>&#160;&#160;&#160; // 在 $chars 中随机取 $length 个数组元素键名<br>&#160;&#160;&#160; $keys = ($chars, $length); </p> <p>&#160;&#160;&#160; $password = '';<br>&#160;&#160;&#160; for($i = 0; $i &lt; $length; $i++)<br>&#160;&#160;&#160; {<br>&#160;&#160;&#160;&#160;&#160;&#160;&#160; // 将 $length 个数组元素连接成字符串<br>&#160;&#160;&#160;&#160;&#160;&#160;&#160; $password .= $chars[$keys[$i]];<br>&#160;&#160;&#160; }</p> <p>&#160;&#160;&#160; return $password;<br>}</p> </td> </tr></tbody></table> <p><strong>时间效率对比</strong></p> <p>我们使用以下PHP代码,计算上面的 3 个随机密码生成函数生成 6 位密码的运行时间,进而对他们的时间效率进行一个简单的对比。</p> <p> </p> <table style="BORDER-RIGHT: #cccccc 1px dotted; TABLE-LAYOUT: fixed; BORDER-TOP: #cccccc 1px dotted; BORDER-LEFT: #cccccc 1px dotted; BORDER-BOTTOM: #cccccc 1px dotted" cellspacing="0" cellpadding="6" width="95%" align="center" border="0"><tbody><tr> <td style="WORD-WRAP: break-word" bgcolor="#fdfddf"> <p>&lt;?php<br>function getmicrotime()<br>{<br>&#160;&#160;&#160; list($usec, $sec) = explode(" ",microtime());<br>&#160;&#160;&#160; return ((float)$usec + (float)$sec);<br>}<br>&#160;<br>// 记录开始时间<br>$time_start = getmicrotime();<br>&#160;&#160;&#160; <br>// 这里放要执行的PHP代码,如:<br>// echo create_password(6);<br>&#160;<br>// 记录结束时间<br>$time_end = getmicrotime();<br>$time = $time_end - $time_start;</p> <p>&#160;// 输出运行总时间 <br>echo "执行时间 $time seconds";<br>?&gt;</p> </td> </tr></tbody></table> <p><strong>最终得出的结果是</strong>:</p> <p>方法一:9.8943710327148E-5 秒</p> <p>方法二:9.6797943115234E-5 秒</p> <p>方法三:0.00017499923706055 秒</p> <p>可以看出方法一和方法二的执行时间都差不多,而方法三的运行时间稍微长了点。</p> <p>原文:http://www.ludou.org/how-to-create-a-password-generator-using-php.html</p>

    Read more +
  • 13

    2019-04
    phpwind商家导航上线测试

    <p> </p> <table style="BORDER-RIGHT: #cccccc 1px dotted; TABLE-LAYOUT: fixed; BORDER-TOP: #cccccc 1px dotted; BORDER-LEFT: #cccccc 1px dotted; BORDER-BOTTOM: #cccccc 1px dotted" cellspacing="0" cellpadding="6" width="95%" align="center" border="0"><tbody><tr> <td style="WORD-WRAP: break-word" bgcolor="#fdfddf"> <font color="#ff0000">WebjxCom提示:</font><font color="#000000">站长之家(chinaz.com)9月21日消息:昨晚,phpwind商家导航体验站上线测试。据了解,phpwind推商家导航主要为了解决本地社区网站的服务商家推广问题。如驾校培训、家居装修、教育、美容等。phpwind商家导航提供捆绑式营销方案,以及灵活的功能配置,可以满足不同的商家</font> </td> </tr></tbody></table> <p>  站长之家(chinaz.com)9月21日消息:昨晚,phpwind商家导航体验站上线测试。据了解,phpwind推商家导航主要为了解决本地社区网站的服务商家推广问题。如驾校培训、家居装修、教育、美容等。phpwind商家导航提供捆绑式营销方案,以及灵活的功能配置,可以满足不同的商家需求。</p> <p>   </p> <center><img alt="" src="http://www.webjx.com/files/allimg/100923/1803130.jpg" width="510" height="478"></center> <p>&#160;</p> <p>  (商家导航站首页截图)</p> <p>   </p> <center><img alt="" src="http://www.webjx.com/files/allimg/100923/1803131.jpg" width="510" height="442"></center> <p>&#160;</p> <p>  (商家分类页面截图)</p> <p>   </p> <center><img alt="" src="http://www.webjx.com/files/allimg/100923/1803132.jpg" width="510" height="311"></center> <p>&#160;</p> <p>  (商家宣传页面截图)</p> <p>  此外,phpwind商家导航可实现的不仅仅是对商品、店铺的简单展示,她还有融合社区元素的交互功能,可满足不同的商家需求。内置店铺组管理、门户化等诸多功能,可大幅度降低本地社区网站运营成本。</p> <p>  phpwind商家导航站的五个亮点:</p> <p>  亮点一:站长可以对不同等级店铺设置对应权限,店铺出售价格也可以高低不同,满足市场不同需求口味!</p> <p>  亮点二:站内搜索绑定店铺广告位,增加站长盈利点。</p> <p>  亮点三:商家店铺集成了web IM(QQ、旺旺),让社区用户和商家交流更便捷!</p> <p>  亮点四:商家导航门户页,可以自定义显示商品或者店铺,给商家提供更多的推广渠道,给站长带来更多的收益!</p> <p>  亮点五:微支付减少商家推广成本。可以通过论坛积分直接购买置顶、加红等推广列表页推广位置,前台简单操作给站长和商家带来双赢!</p> <p>  商家导航演示地址:http://tiyan.phpwind.net/fc/index.php?m=dianpu</p>

    Read more +
  • 13

    2019-04
    PHP实例:国际标准书号ISBN码校验函数

    <p> </p> <table style="BORDER-RIGHT: #cccccc 1px dotted; TABLE-LAYOUT: fixed; BORDER-TOP: #cccccc 1px dotted; BORDER-LEFT: #cccccc 1px dotted; BORDER-BOTTOM: #cccccc 1px dotted" cellspacing="0" cellpadding="6" width="95%" align="center" border="0"><tbody><tr> <td style="WORD-WRAP: break-word" bgcolor="#fdfddf"> <font color="#ff0000">WebjxCom提示:</font><font color="#000000">PHP校验ISBN码的函数.</font> </td> </tr></tbody></table> <p>最近在编写一个图书管理程序的时候,需要校验图书ISBN码正确性,查了一些资料,了解了图书ISBN码的构成,详细资料可以参考:国际标准书号 &#8211; 维基百科,下面还是简述一下什么是ISBN码:</p> <p>国际标准书号(International Standard Book Number,ISBN;拟发音is-ben),是国际通用的图书或独立的出版物(除定期出版的期刊)代码。出版社可以通过国际标准书号清晰的辨认所有非期刊书籍。一个国际标准书号只有一个或一份相应的出版物与之对应。新版本如果在原来旧版的基础上没有内容上太大的变动,在出版时也不会得到新的国际标准书号码。当平装本改为精装本出版时,原来相应的国际标准书号号码也应当收回。</p> <p>平常我们能够见到的ISBN码有10位和13位两种,其中10位的ISBN自2007年1月起已经停止使用,目前新出版的图书ISBN码都是13位。考虑到一个严谨的图书管理程序要考虑到多方面的问题,因为10位ISBN码的图书还是有巨大的存世量的,所以要校验图书ISBN码的正确性,就必须同时考虑10位和13位的情况。从维基百科可以了解到ISBN码最后一位是校验码,其实要想校验ISBN码的正确,就是通过计算ISBN的校验码,看是否与最后一位吻合。这里所说的校验也只是校验ISBN在构成上是否合法,而不会校验是否为已发行图书的ISBN。下面是维基百科提供的ISBN码校验算法:</p> <p>校验码的计算方法(10码)</p> <p>假设某国际标准书号号码前9位是:7-309-04547 </p> <p>计算加权和S:S = 7×10+3×9+0×8+9×7+0×6+4×5+5×4+4×3+7×2 = 226 </p> <p>计算S÷11的余数M:M = 226 mod 11 = 6 </p> <p>计算11 &#8211; M 的差N:N = 11 ? 6 = 5 </p> <p>如果N = 10,校验码是字母"X" </p> <p>如果N = 11,校验码是数字"0" </p> <p>如果N为其他数字,校验码是数字N </p> <p>所以,本书的校验码是5;如果用户提供的ISBN码是7-309-04547-6,那么校验失败</p> <p>校验码的计算方法(13码)</p> <p>假设某国际标准书号号码前12位是:978-986-181-728 </p> <p>计算加权和S:S = (9×1)+(7×3)+(8×1)+(9×3)+(8×1)+(6×3)+(1×1)+(8×3)+(1×1)+(7×3)+(2×1)+(8×3) = 164 </p> <p>计算S÷10的余数M:M = 164 mod 10 = 4 </p> <p>计算10 &#8211; M 的差N:N = 10 ? 4 = 6 </p> <p>如果N = 10,校验码是数字"0" </p> <p>如果N为其他数字,校验码是数字N </p> <p>所以,本书的校验码是6。完整的国际标准书号号码为 ISBN 978-986-181-728-6</p> <p>好了,背景知识介绍到这,下面我写的ISBN码校验函数(php版),需要的话可以直接使用:</p> <p> </p> <table style="BORDER-BOTTOM: #0099cc 1px solid; BORDER-LEFT: #0099cc 1px solid; TABLE-LAYOUT: fixed; BORDER-TOP: #0099cc 1px solid; BORDER-RIGHT: #0099cc 1px solid" border="0" cellspacing="0" cellpadding="6" width="95%" align="center"><tbody><tr> <td style="WORD-WRAP: break-word" bgcolor="#ddedfb"> <p>function isbn_sum($isbn, $len)<br>{<br>/* <br>&#160;* 该函数用于计算ISBN加权和 <br>&#160;* 参数说明:<br>&#160;*&#160;&#160; $isbn : isbn码<br>&#160;*&#160;&#160; $len&#160; : isbn码长度<br>&#160;*/<br>&#160;&#160;&#160; $sum = 0;<br>&#160;&#160;&#160; if ($len == 10)<br>&#160;&#160;&#160; {<br>&#160;&#160;&#160;&#160;&#160;&#160;&#160; for ($i = 0; $i &lt; $len-1; $i++)<br>&#160;&#160;&#160;&#160;&#160;&#160;&#160; {<br>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; $sum = $sum + (int)$isbn[$i] * ($len - $i);<br>&#160;&#160;&#160;&#160;&#160;&#160;&#160; }<br>&#160;&#160;&#160; }<br>&#160;&#160;&#160; elseif ($len == 13)<br>&#160;&#160;&#160; {<br>&#160;&#160;&#160;&#160;&#160;&#160;&#160; for ($i = 0; $i &lt; $len-1; $i++)<br>&#160;&#160;&#160;&#160;&#160;&#160;&#160; {<br>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; if ($i % 2 == 0)<br>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; $sum = $sum + (int)$isbn[$i];<br>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; else<br>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; $sum = $sum + (int)$isbn[$i] * 3;<br>&#160;&#160;&#160;&#160;&#160;&#160;&#160; }<br>&#160;&#160;&#160; }<br>&#160;&#160;&#160; return $sum;<br>}<br>function isbn_compute($isbn, $len)<br>{<br>/* <br>* 该函数用于计算ISBN末位校验码<br>* 参数说明:<br>*&#160;&#160; $isbn : isbn码<br>*&#160;&#160; $len&#160; : isbn码长度<br>*/<br>&#160;&#160;&#160; if ($len == 10)<br>&#160;&#160;&#160; {<br>&#160;&#160;&#160;&#160;&#160;&#160;&#160; $digit = 11 - isbn_sum($isbn, $len) % 11;</p> <p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; if ($digit == 10)<br>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; $rc = 'X';<br>&#160;&#160;&#160;&#160;&#160;&#160;&#160; else if ($digit == 11)<br>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; $rc = '0';<br>&#160;&#160;&#160;&#160;&#160;&#160;&#160; else<br>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; $rc = (string)$digit;<br>&#160;&#160;&#160; }<br>&#160;&#160;&#160; else if($len == 13)<br>&#160;&#160;&#160; {<br>&#160;&#160;&#160;&#160;&#160;&#160;&#160; $digit = 10 - isbn_sum($isbn, $len) % 10;</p> <p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; if ($digit == 10)<br>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; $rc = '0';<br>&#160;&#160;&#160;&#160;&#160;&#160;&#160; else<br>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; $rc = (string)$digit;<br>&#160;&#160;&#160; }<br>&#160;&#160;&#160; return $rc;<br>}<br>function is_isbn($isbn)<br>{<br>/* <br>&#160;* 该函数用于判断是否为ISBN号 <br>&#160;* 参数说明:<br>&#160;*&#160;&#160;&#160; $isbn : isbn码<br>&#160;*/<br>&#160;&#160;&#160; $len = strlen($isbn);<br>&#160;&#160;&#160; if ($len!=10 &amp;&amp; $len!=13)<br>&#160;&#160;&#160;&#160;&#160;&#160;&#160; return 0;<br>&#160;&#160;&#160; $rc = isbn_compute($isbn, $len);<br>&#160;&#160;&#160; if ($isbn[$len-1] != $rc)&#160;&#160; /* ISBN尾数与计算出来的校验码不符 */<br>&#160;&#160;&#160;&#160;&#160;&#160;&#160; return 0;<br>&#160;&#160;&#160; else<br>&#160;&#160;&#160;&#160;&#160;&#160;&#160; return 1;<br>}</p> </td> </tr></tbody></table> <p>函数写好后,就可以直接调用了,下面是调用示例:</p> <p> </p> <table style="BORDER-BOTTOM: #0099cc 1px solid; BORDER-LEFT: #0099cc 1px solid; TABLE-LAYOUT: fixed; BORDER-TOP: #0099cc 1px solid; BORDER-RIGHT: #0099cc 1px solid" border="0" cellspacing="0" cellpadding="6" width="95%" align="center"><tbody><tr> <td style="WORD-WRAP: break-word" bgcolor="#ddedfb">&lt;?php echo is_isbn('9787507421781') ? '校验通过' : '校验失败'; ?&gt;</td> </tr></tbody></table> <p>原文:<font color="#000000">http://www.ludou.org/php-check-isbn.html</font></p>

    Read more +
  • 13

    2019-04
    PHP驱动MongoDB整数问题的BUG和策略

    <p> </p> <table style="BORDER-RIGHT: #cccccc 1px dotted; TABLE-LAYOUT: fixed; BORDER-TOP: #cccccc 1px dotted; BORDER-LEFT: #cccccc 1px dotted; BORDER-BOTTOM: #cccccc 1px dotted" cellspacing="0" cellpadding="6" width="95%" align="center" border="0"><tbody><tr> <td style="WORD-WRAP: break-word" bgcolor="#fdfddf"> <font color="#ff0000">WebjxCom提示:</font><font color="#000000">PHP驱动MongoDB整数问题的BUG和策略.</font> </td> </tr></tbody></table> <p>本文所说的<a href="http://jira.mongodb.org/browse/PHP-138" target="_blank"><font color="#0000ff">整数问题</font></a>,其实并不是MongoDB的问题,而是PHP驱动的问题:MongoDB本身有两种整数类型,分别是:32位整数和64位整数,但旧版的PHP驱动不管操作系统是32位还是64位,把所有整数都当做32位整数处理,结果导致64位整数被截断。为了在尽可能保持兼容性的前提下解决这个问题,新版PHP驱动加入了<a href="http://www.php.net/manual/en/mongo.configuration.php#ini.mongo.native-long" target="_blank"><font color="#0000ff">mongo.native-long</font></a>选项,以期在64位操作系统中把整数都当做64位来处理,有兴趣的可参考:<a href="http://derickrethans.nl/64bit-ints-in-mongodb.html" target="_blank"><font color="#0000ff">64-bit integers in MongoDB</font></a>。</p> <p>那么PHP驱动真的完全解决了整数问题么?NO!在处理group操作的时候还有<a href="http://jira.mongodb.org/browse/PHP-163" target="_blank"><font color="#0000ff">BUG</font></a>:</p> <p>为了说明问题,我们先来生成一些测试数据:</p> <p> </p> <table style="BORDER-BOTTOM: #0099cc 1px solid; BORDER-LEFT: #0099cc 1px solid; TABLE-LAYOUT: fixed; BORDER-TOP: #0099cc 1px solid; BORDER-RIGHT: #0099cc 1px solid" border="0" cellspacing="0" cellpadding="6" width="95%" align="center"><tbody><tr> <td style="WORD-WRAP: break-word" bgcolor="#ddedfb"> <p><code><font face="NSimsun">&lt;?php<br><br>ini_set('mongo.native_long', 1);<br><br>$instance = new Mongo();<br><br>$instance = $instance-&gt;selectCollection('test', 'test');<br><br>for ($i = 0; $i &lt; 10; $i++) {<br>&#160;&#160;&#160; $instance-&gt;insert(array(<br>&#160;&#160;&#160;&#160;&#160;&#160;&#160; 'group_id' =&gt; rand(1, 5),<br>&#160;&#160;&#160;&#160;&#160;&#160;&#160; 'count'&#160;&#160;&#160; =&gt; rand(1, 5),<br>&#160;&#160;&#160; ));<br>}<br><br>?&gt;</font></code></p> </td> </tr></tbody></table> <p>下面让我们使用group操作,根据group_id分组,汇总计算count:</p> <p> </p> <table style="BORDER-BOTTOM: #0099cc 1px solid; BORDER-LEFT: #0099cc 1px solid; TABLE-LAYOUT: fixed; BORDER-TOP: #0099cc 1px solid; BORDER-RIGHT: #0099cc 1px solid" border="0" cellspacing="0" cellpadding="6" width="95%" align="center"><tbody><tr> <td style="WORD-WRAP: break-word" bgcolor="#ddedfb"> <p><code><font size="2" face="新宋体">&lt;?php<br><br>ini_set('mongo.native_long', 1);<br><br>$instance = new Mongo();<br><br>$instance = $instance-&gt;selectCollection('test', 'test');<br><br>$keys = array('group_id' =&gt; 1);<br><br>$initial = array('count' =&gt; 0);<br><br>$reduce = '<br>&#160;&#160;&#160; function(obj, prev) {<br>&#160;&#160;&#160;&#160;&#160;&#160;&#160; prev.count += obj.count;<br>&#160;&#160;&#160; }<br>';<br><br>$result = $instance-&gt;group($keys, $initial, $reduce);<br><br>var_dump($result);<br><br>?&gt;</font></code></p> </td> </tr></tbody></table> <p>结果和预想的有出入,count没有实现累加,而是变成了[object Object],目前,如果必须使用group操作,那么有两种方法可以缓解这个问题:</p> <p> </p> <table style="BORDER-BOTTOM: #0099cc 1px solid; BORDER-LEFT: #0099cc 1px solid; TABLE-LAYOUT: fixed; BORDER-TOP: #0099cc 1px solid; BORDER-RIGHT: #0099cc 1px solid" border="0" cellspacing="0" cellpadding="6" width="95%" align="center"><tbody><tr> <td style="WORD-WRAP: break-word" bgcolor="#ddedfb"> <p><code><font size="2" face="新宋体">ini_set('mongo.native_long', 0);</font></code></p> </td> </tr></tbody></table> <p> </p> <table style="BORDER-BOTTOM: #0099cc 1px solid; BORDER-LEFT: #0099cc 1px solid; TABLE-LAYOUT: fixed; BORDER-TOP: #0099cc 1px solid; BORDER-RIGHT: #0099cc 1px solid" border="0" cellspacing="0" cellpadding="6" width="95%" align="center"><tbody><tr> <td style="WORD-WRAP: break-word" bgcolor="#ddedfb"> <p><code><font size="2" face="新宋体">$initial = array('count' =&gt; (float)0);</font></code></p> </td> </tr></tbody></table> <p>这两种方法都是治标不治本的权宜之计,既然当前PHP驱动里group的实现有问题,那我们就绕开它,用其它的方式实现同样的功能,这个方式就是<a href="http://www.mongodb.org/display/DOCS/MapReduce" target="_blank"><font color="#0000ff">MapReduce</font></a>:</p> <p> </p> <table style="BORDER-BOTTOM: #0099cc 1px solid; BORDER-LEFT: #0099cc 1px solid; TABLE-LAYOUT: fixed; BORDER-TOP: #0099cc 1px solid; BORDER-RIGHT: #0099cc 1px solid" border="0" cellspacing="0" cellpadding="6" width="95%" align="center"><tbody><tr> <td style="WORD-WRAP: break-word" bgcolor="#ddedfb"> <p><code><font size="2" face="新宋体">&lt;?php<br><br>ini_set('mongo.native_long', 1);<br><br>$instance = new Mongo();<br><br>$instance = $instance-&gt;selectDB('test');<br><br>$map = '<br>&#160;&#160;&#160; function() {<br>&#160;&#160;&#160;&#160;&#160;&#160;&#160; emit(this.group_id, this.count);<br>&#160;&#160;&#160; }<br>';<br><br>$reduce = '<br>&#160;&#160;&#160; function(key, values) {<br>&#160;&#160;&#160;&#160;&#160;&#160;&#160; var sum = 0;<br><br>&#160;&#160;&#160;&#160;&#160;&#160;&#160; for (var index in values) {<br>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; sum += values[index];<br>&#160;&#160;&#160;&#160;&#160;&#160;&#160; }<br><br>&#160;&#160;&#160;&#160;&#160;&#160;&#160; return sum;<br>&#160;&#160;&#160; }<br>';<br><br>$result = $instance-&gt;command(array(<br>&#160;&#160;&#160; 'mapreduce' =&gt; 'test',<br>&#160;&#160;&#160; 'map'&#160;&#160;&#160;&#160;&#160;&#160; =&gt; $map,<br>&#160;&#160;&#160; 'reduce'&#160;&#160;&#160; =&gt; $reduce<br>));<br><br>$result = iterator_to_array($instance-&gt;{$result['result']}-&gt;find());<br><br>var_dump($result);<br><br>?&gt;</font></code></p> </td> </tr></tbody></table> <p>把大象放冰箱里需要三步,而使用MapReduce仅仅需要Map和Reduce两步即可,这里有一个PDF文档生动的说明了MySQL中GROUP BY和MongoDB中MapReduce的对应关系:</p> <p align="center"><a href="http://www.chinaz.com/upimg/userup/1103/1409294BM3.jpg" target="_blank"><img border="0" alt="" src="http://www.webjx.com/files/allimg/110324/1019180.jpg" width="570" height="441"></a>&#160;</p> <p align="center"><a href="http://rickosborne.org/blog/2010/02/infographic-migrating-from-sql-to-mapreduce-with-mongodb/" target="_blank"><font color="#0000ff">SQL to MongoDB</font></a></p> <p>此外,还有很多资料可供参考,如:<a href="http://kylebanker.com/blog/2009/12/mongodb-map-reduce-basics/" target="_blank"><font color="#0000ff">MongoDB Aggregation III: Map-Reduce Basics</font></a>。</p> <p>说明:软件版本为MongoDB(1.6.5),PECL Mongo(1.1.4)。不同版本结论可能不同。</p>

    Read more +
  • 13

    2019-04
    PHP技巧教程:PHP网站开发常用8个小技巧

    <p> </p> <table style="BORDER-RIGHT: #cccccc 1px dotted; TABLE-LAYOUT: fixed; BORDER-TOP: #cccccc 1px dotted; BORDER-LEFT: #cccccc 1px dotted; BORDER-BOTTOM: #cccccc 1px dotted" cellspacing="0" cellpadding="6" width="95%" align="center" border="0"><tbody><tr> <td style="WORD-WRAP: break-word" bgcolor="#fdfddf"> <font color="#ff0000">WebjxCom提示:</font><font color="#000000">本文总结了PHP日常开发中常用的8个小技巧。</font> </td> </tr></tbody></table> <p>本文总结了PHP日常开发中常用的8个小技巧。</p> <p>PHP批最取得checkbox的值<br><br>1、命名<br><br>&lt;input type='checkbox' name='checkbox[]' value=dwmyrow[banzhu] /&gt;<br><br>2、使用<br><br>当计划当作sql指令的一部分时:如果参与控制的字段是数值型的,则<br><br>if(! empty(_POST['checkbox'])) {<br>expr = join(",", _POST['checkbox']);<br>sql = "select * from tbl_name where field in (expr)";<br>}<br><br>如果参与控制的字段是数值型的,则<br><br>if(! empty(_POST['checkbox'])) {<br>expr = "'".join("','", _POST['checkbox']).".";<br>sql = "select * from tbl_name where field in (expr)";<br>}<br><br>PHP判断Form表单是否提交<br><br>action=HTTP_POST_VARS["Button1"];<br>if(action=="提交")<br>{<br>//执行表单操作<br>}<br>else<br>{<br>//读取默认值<br>}<br><br>PHP 获取字符串长度<br><br>strlen(myrow[1])<br><br>PHP Url转向<br><br>Header("Location: "._SERVER["HTTP_REFERER"]);<br><br>PHP超全局对象<br><br>&lt;?php<br>a = 1;<br>b = 2;<br>function Sum()<br>{<br>GLOBALS["b"] = GLOBALS["a"] + GLOBALS["b"];<br>}<br>Sum();<br>echo b;<br>?&gt;<br><br>PHP 表单取值<br><br>如果 mothod="get" 就用 _GET["test"] 代替test <br>如果 mothod="post" 就用 _POST["test"] 代替test<br><br>PHP取得当前IP<br><br>&lt;?=HTTP_SERVER_VARS["REMOTE_ADDR"]?&gt;<br><br>PHP 取得当前时间<br><br>&lt;?php<br>echo date("Y-m-d G:i:s");<br>?&gt;<br>date("Y年m月d日")<br>Date ("Y-n-j")</p>

    Read more +
  • 13

    2019-04
    PHP代码源有可能被污染 建议下载要小心

    <p> </p> <table style="BORDER-RIGHT: #cccccc 1px dotted; TABLE-LAYOUT: fixed; BORDER-TOP: #cccccc 1px dotted; BORDER-LEFT: #cccccc 1px dotted; BORDER-BOTTOM: #cccccc 1px dotted" cellspacing="0" cellpadding="6" width="95%" align="center" border="0"><tbody><tr> <td style="WORD-WRAP: break-word" bgcolor="#fdfddf"> <font color="#ff0000">WebjxCom提示:</font><font color="#000000">PHP官方称PHP代码源被污染 用户下载需谨慎.</font> </td> </tr></tbody></table> <p align="center"><img style="WIDTH: 511px; HEIGHT: 298px" border="0" alt="" src="http://www.webjx.com/files/allimg/110327/1141490.jpg" width="510" height="417"></p> <p align="center">PHP官方网站(<a href="http://www.php.net/" target="_blank"><font color="#000000">http://www.php.net/</font></a>)</p> <p>3月25日消息:据PHP官方网站发布新闻得知其wiki账号被盗,原因是wiki.php.net漏洞导致的,而wiki的账号和php代码源的SVN提交权限相关联,从而导致PHP代码受污染。</p> <p>据了解,PHP5.3.6以及其后续版本的代码已经被污染,目前只能把未受污染的代码版本确保到PHP5.3.5,下载PHP代码的用户,需谨慎。</p> <table style="BORDER-BOTTOM: #0099cc 1px solid; BORDER-LEFT: #0099cc 1px solid; TABLE-LAYOUT: fixed; BORDER-TOP: #0099cc 1px solid; BORDER-RIGHT: #0099cc 1px solid" border="0" cellspacing="0" cellpadding="6" width="95%" align="center"><tbody><tr> <td style="WORD-WRAP: break-word" bgcolor="#ddedfb"> <strong><font color="#ff0000">原文内容:</font><br></strong>The wiki.php.net box was compromised and the attackers were able to collect wiki account credentials. No other machines in the php.net infrastructure appear to have been affected. Our biggest concern is, of course, the integrity of our source code. We did an extensive code audit and looked at every commit since 5.3.5 to make sure that no stolen accounts were used to inject anything malicious. Nothing was found. The compromised machine has been wiped and we are forcing a password change for all svn accounts. <p>We are still investigating the details of the attack which combined a vulnerability in the Wiki software with a Linux root exploit.</p> </td> </tr></tbody></table> <p><strong>内容大致是:</strong></p> <p>由于wiki账号被盗,PHP的代码源极有可能被污染,当然,PHP团队已经做最大的努力以保证自PHP5.3.5版本的代码没有收到污染,并且强迫SVN修改现有的密码。</p> <p>而事件目前的状态是,他们仍然没法锁定漏洞所在,因为他们仍在排查。</p> <p>一个很明显的问题是,PHP5.3.6以及其后续版本的代码已经被污染,目前只能把未受污染的代码版本确保到PHP5.3.5,下载PHP代码的人,要小心了。</p> <p>而windows.php.net和wiki.php.net也已经暂停访问。</p>

    Read more +
  • 13

    2019-04
    PHP教程:PHP处理数组模式的以选未选input多选框

    <p> </p> <table style="BORDER-RIGHT: #cccccc 1px dotted; TABLE-LAYOUT: fixed; BORDER-TOP: #cccccc 1px dotted; BORDER-LEFT: #cccccc 1px dotted; BORDER-BOTTOM: #cccccc 1px dotted" cellspacing="0" cellpadding="6" width="95%" align="center" border="0"><tbody><tr> <td style="WORD-WRAP: break-word" bgcolor="#fdfddf"> <font color="#ff0000">WebjxCom提示:</font><font color="#000000">一般从数据循环出来的选框要处理是否被选中都是使用IF去判断,结果造成代码一堆,速度过慢。</font> </td> </tr></tbody></table> 一般从数据循环出来的选框要处理是否被选中都是使用IF去判断,结果造成代码一堆,速度过慢。<br><br>我做了一个闭包分享给大家,希望对大家有用。<br><br>代码: <div class="blockcode"> <div id="code1558_-1"> <ol> <li>function ifNumExists($numList,$key) {<br> </li> <li>$return = false;<br> </li> <li>$arraylist = split(",", $numList);<br> </li> <li>$Length = count($arraylist)-1; //最后一个数组结果为空,所以应当减去。<br> </li> <li>&#160; &#160; &#160; &#160; for ($i=0;$i&lt;$Length;$i++){<br> </li> <li>&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; if ($arraylist[$i] == $key) {<br> </li> <li>&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; $return = true;<br> </li> <li>&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; }<br> </li> <li>&#160; &#160; &#160; &#160; }<br> </li> <li>&#160; &#160; &#160; &#160; return $return;<br> </li> <li>}<br> </li> </ol> </div> <br> </div> 使用方法: <div class="blockcode"> <div id="code1558_0"> <ol> <li>ifNumExists(数组,当前单选框对应ID)<br> </li> </ol> </div> <br> </div> <strong>表结构:</strong><br>单选框循环表(A):<br>id   class<br>1   类别1<br>2   类别2<br>3   类别3<br>4   类别4<br><br>单选值存放表(B):<br>id   classid<br>1   1,2,3,<br>2   2,3,4,<br>3   1,2,<br><br>当循环表A,判断是否当前input是否被选中,那么我们就可以使用<br>ifNumExists(classid,表Aid),返回的结果为true或者false,根据返回的结果我们给input增加或者不增加 checked="checked"。<br>如: <ol> <li>if (ifNumExists(classid,$value['id'])) {<br> </li> <li> $list = $list."&lt;input type=\"checkbox\" name=\"SendNums[]\" value=\"".$value['id']."\" checked=\"checked\" /&gt;".$value['class']."&lt;/li&gt;";<br> </li> <li>}else{<br> </li> <li> $list = $list."&lt;input type=\"checkbox\" name=\"SendNums[]\" value=\"".$value['id']."\" /&gt;".$value['class']."&lt;/li&gt;";<br> </li> <li>}<br> </li> <li>return $list; </li> </ol>

    Read more +
  • 13

    2019-04
  • 13

    2019-04
    PHP环境安装套件:快速安装LAMP环境

    <p> </p> <table style="BORDER-RIGHT: #cccccc 1px dotted; TABLE-LAYOUT: fixed; BORDER-TOP: #cccccc 1px dotted; BORDER-LEFT: #cccccc 1px dotted; BORDER-BOTTOM: #cccccc 1px dotted" cellspacing="0" cellpadding="6" width="95%" align="center" border="0"><tbody><tr> <td style="WORD-WRAP: break-word" bgcolor="#fdfddf"> <font color="#ff0000">WebjxCom提示:</font><font color="#000000">推荐 6 款 LAMP 快速安装套件.</font> </td> </tr></tbody></table> <p>LAMP是一个缩写,它指一组通常一起使用来运行动态网站或者服务器的自由软件:</p> <p>Linux,操作系统;</p> <p>Apache,网页服务器;</p> <p>MySQL,数据库管理系统(或者数据库服务器);</p> <p>PHP 和有</p>

    Read more +
  • 13

    2019-04
    PHP中运行的文件管理系统:ajaxplorer

    <p> </p> <table style="BORDER-RIGHT: #cccccc 1px dotted; TABLE-LAYOUT: fixed; BORDER-TOP: #cccccc 1px dotted; BORDER-LEFT: #cccccc 1px dotted; BORDER-BOTTOM: #cccccc 1px dotted" cellspacing="0" cellpadding="6" width="95%" align="center" border="0"><tbody><tr> <td style="WORD-WRAP: break-word" bgcolor="#fdfddf"> <font color="#ff0000">WebjxCom提示:</font><font color="#000000">功能强大的php文件管理器ajaxplorer使用教程.</font> </td> </tr></tbody></table> <p>由于在VPS上安装FTP总是失败,需要一个可以通过Web进行文件管理的工具。AjaXplorer是一个在PHP中运行的文件管理系统,功能的强大以及界面的华丽实在是第一次见到。</p> <p align="center"><a href="/files/allimg/110607/1917270.jpg" target="_blank"><img style="WIDTH: 510px; HEIGHT: 420px" border="0" alt="" src="http://www.webjx.com/files/allimg/110607/1917270.jpg" width="510" height="755"></a></p> <p>官方网站:http://ajaxplorer.info 已经被伟大的墙屏蔽。</p> <p><strong>安装及使用:</strong></p> <p>1.下载AjaXplorer文件包,您可以直接在下面的地址中下载,这个版本是3.2.1,下载后当然是上传到网站上,最好给它一个专用的文件夹,比如/explorer</p> <p>AjaXplorer.zip (2)</p> <p>2.直接访问刚才安装AjaXplorer的目录,可能会提示一些服务器支持的错误,不用管它,直接进去,使用默认用户名admin密码admin登陆。</p> <p>3.登陆后,点击右上角“logged as admin”的下拉菜单中的Language更改语言,改为Chinese-zhCN.UTF-8这个就是简体中文。</p> <p align="center"><img style="WIDTH: 510px; HEIGHT: 278px" border="0" alt="" src="http://www.webjx.com/files/allimg/110607/1917271.jpg" width="510" height="341"></p> <p align="center"><img border="0" alt="" src="http://www.webjx.com/files/allimg/110607/1917272.jpg" width="426" height="525"></p> <p>4.设置目录。如图点击左上角的一个下拉菜单,选中设置,然后选择Repositories,再点击上面的New Repository。(如果找不到请参考以下图片)</p> <p align="center"><img border="0" alt="" src="http://www.webjx.com/files/allimg/110607/1917273.jpg" width="281" height="269"></p> <p align="center"><a href="/files/allimg/110607/1917274.jpg" target="_blank"><img style="WIDTH: 510px; HEIGHT: 230px" border="0" alt="" src="http://www.webjx.com/files/allimg/110607/1917274.jpg" width="510" height="332"></a></p> <p align="center"><img border="0" alt="" src="http://www.webjx.com/files/allimg/110607/1917275.jpg" width="177" height="130"></p> <p>5.填写相关信息。</p> <p>Reponsitories Label 名称,随便填写就可以</p> <p>Reponsitories Driver 选择File System</p> <p>Path 选择要管理的目录,也可以填写根目录</p> <p>File Creation Mask 权限,建议填写0777</p> <p>其他的按照下图填写即可。</p> <p align="center"><img border="0" alt="" src="http://www.webjx.com/files/allimg/110607/1917276.jpg" width="406" height="570"></p> <p>6.在左边选择刚才新建的目录就OK啦。</p> <p>转载请注明转自EinCy 本文原始链接地址:<a href="http://www.eincy.com/ajaxplorer" target="_blank">http://www.eincy.com/ajaxplorer</a> </p>

    Read more +
  • 13

    2019-04
    PHP教程:基于正则表达式替换的模板引擎

    <p> </p> <table style="BORDER-RIGHT: #cccccc 1px dotted; TABLE-LAYOUT: fixed; BORDER-TOP: #cccccc 1px dotted; BORDER-LEFT: #cccccc 1px dotted; BORDER-BOTTOM: #cccccc 1px dotted" cellspacing="0" cellpadding="6" width="95%" align="center" border="0"><tbody><tr> <td style="WORD-WRAP: break-word" bgcolor="#fdfddf"> <font color="#ff0000">WebjxCom提示:</font><font color="#000000">模板引擎正则表达式调试小技巧.</font> </td> </tr></tbody></table> <p>很久没有遇上PHP难题了,这次正则问题占了一点时间,还是老问题最大回溯、递归限制问题。学习透之后其实并不难修改调试有这类问题的正则。主要是以下几点。</p> <p>基于正则表达式替换的模板引擎很容易遇上正则表达式最大回溯/递归的限制。</p> <p>惰性匹配并不可怕,正常情况下模板并不会不够用,往往不会超出限制,discuz的模板引擎就大量使用了。但是因此而不去注意、不去学习,则容易书写错误并遇上问题。</p> <p>当preg_*返回的是null的时候则要注意了,判断函数是is_null.</p> <p>出错并不可怕,但是最好把错误都完整的输出,这样调试就很容易了。</p> <p>除了输出出错原因,还要输出匹配的文本和使用的正则,这样就很容易调试了。</p> <p>PHP代码</p> <table style="BORDER-BOTTOM: #0099cc 1px solid; BORDER-LEFT: #0099cc 1px solid; TABLE-LAYOUT: fixed; BORDER-TOP: #0099cc 1px solid; BORDER-RIGHT: #0099cc 1px solid" border="0" cellspacing="0" cellpadding="6" width="95%" align="center"><tbody><tr> <td style="WORD-WRAP: break-word" bgcolor="#ddedfb"> <ol class="dp-c"> <li class="alt"> <span><span>&lt;?php &#160;&#160;</span></span> </li> <li> <span class="keyword">if</span><span>&#160;(</span><span class="func">is_null</span><span>(</span><span class="vars">$tmp</span><span>)){ &#160;&#160;</span> </li> <li class="alt"> <span>&#160;&#160;&#160;&#160;</span><span class="vars">$error_code</span><span>&#160;=&#160;preg_last_error(); &#160;&#160;</span> </li> <li> <span>&#160;&#160;&#160;&#160;</span><span class="keyword">switch</span><span>(</span><span class="vars">$error_code</span><span>){ &#160;&#160;</span> </li> <li class="alt"> <span>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;</span><span class="keyword">case</span><span>&#160;PREG_NO_ERROR&#160;: &#160;&#160;</span> </li> <li> <span>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;</span><span class="func">echo</span><span>&#160;</span><span class="string">'PREG_NO_ERROR'</span><span>; &#160;&#160;</span> </li> <li class="alt"> <span>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;</span><span class="keyword">break</span><span>; &#160;&#160;</span> </li> <li> <span>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;</span><span class="keyword">case</span><span>&#160;PREG_INTERNAL_ERROR: &#160;&#160;</span> </li> <li class="alt"> <span>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;</span><span class="func">echo</span><span>&#160;</span><span class="string">'PREG_INTERNAL_ERROR'</span><span>; &#160;&#160;</span> </li> <li> <span>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;</span><span class="keyword">break</span><span>; &#160;&#160;</span> </li> <li class="alt"> <span>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;</span><span class="keyword">case</span><span>&#160;PREG_BACKTRACK_LIMIT_ERROR: &#160;&#160;</span> </li> <li> <span>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;</span><span class="func">echo</span><span>&#160;</span><span class="string">'PREG_BACKTRACK_LIMIT_ERROR'</span><span>; &#160;&#160;</span> </li> <li class="alt"> <span>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;</span><span class="keyword">break</span><span>; &#160;&#160;</span> </li> <li> <span>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;</span><span class="keyword">case</span><span>&#160;PREG_RECURSION_LIMIT_ERROR: &#160;&#160;</span> </li> <li class="alt"> <span>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;</span><span class="func">echo</span><span>&#160;</span><span class="string">'PREG_RECURSION_LIMIT_ERROR'</span><span>; &#160;&#160;</span> </li> <li> <span>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;</span><span class="keyword">break</span><span>; &#160;&#160;</span> </li> <li class="alt"> <span>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;</span><span class="keyword">case</span><span>&#160;PREG_BAD_UTF8_ERROR: &#160;&#160;</span> </li> <li> <span>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;</span><span class="func">echo</span><span>&#160;</span><span class="string">'PREG_BAD_UTF8_ERROR'</span><span>; &#160;&#160;</span> </li> <li class="alt"> <span>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;</span><span class="keyword">break</span><span>; &#160;&#160;</span> </li> <li> <span>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;</span><span class="keyword">case</span><span>&#160;PREG_BAD_UTF8_OFFSET_ERROR: &#160;&#160;</span> </li> <li class="alt"> <span>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;</span><span class="func">echo</span><span>&#160;</span><span class="string">'PREG_BAD_UTF8_OFFSET_ERROR'</span><span>; &#160;&#160;</span> </li> <li> <span>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;</span><span class="keyword">break</span><span>; &#160;&#160;</span> </li> <li class="alt"> <span>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;</span><span class="keyword">default</span><span>: &#160;&#160;</span> </li> <li> <span>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;</span><span class="func">echo</span><span>&#160;</span><span class="string">'UNKNOW&#160;ERROR'</span><span>; &#160;&#160;</span> </li> <li class="alt"> <span>&#160;&#160;&#160;&#160;} &#160;&#160;</span> </li> <li> <span>&#160;&#160;&#160;&#160;</span><span class="func">exit</span><span>; &#160;&#160;</span> </li> <li class="alt"> <span>}&#160;&#160;</span> </li> </ol> </td> </tr></tbody></table> <p><strong>参考资料</strong></p> <p>1、2010, Laruence <a href="http://www.laruence.com/2010/06/08/1579.html" target="_blank"><font color="#0000ff">《深悉正则(pcre)最大回溯/递归限制》</font></a></p> <p>2、2011, PHP中文手册<a href="http://us2.php.net/manual/zh/function.preg-last-error.php" target="_blank"><font color="#0000ff"> preg_last_error</font></a></p>

    Read more +
  • 13

    2019-04
    PHPUnZip:在线解压缩PHP的工具

    <p> </p> <table style="BORDER-RIGHT: #cccccc 1px dotted; TABLE-LAYOUT: fixed; BORDER-TOP: #cccccc 1px dotted; BORDER-LEFT: #cccccc 1px dotted; BORDER-BOTTOM: #cccccc 1px dotted" cellspacing="0" cellpadding="6" width="95%" align="center" border="0"><tbody><tr> <td style="WORD-WRAP: break-word" bgcolor="#fdfddf"> <font color="#ff0000">WebjxCom提示:</font><font color="#000000">PHP在线解压ZIP工具 - PHPUnZip.</font> </td> </tr></tbody></table> <p>如果要把一个包含很多文件的文件夹上传到服务器,这个文件夹可能是一个CMS,如果直接上传,不论是使用PHP还是FTP,上传的时间都是相当长的,因为这个文件夹包含的文件数量很大,尽管文件可能很小,但每个文件都要建立一次连接,这加起来的时间是很可怕的。通常,我们使用的方法是现把这个文件夹压缩成zip或者tar.gz文件,上传到服务器,然后在服务器上解压,这样可以节省很多时间。</p> <p>很多服务器提供了解压ZIP文件的功能,比如cPanel和Direct Admin面板都有这个功能。但如果你的服务器刚好没有这个功能怎么办呢?这时候可以尝试使用PHP工具。</p> <p>PHPUnZip这款PHP工具体积很小,只有一个文件,它可以在服务器上方便地解压ZIP文件。</p> <p><strong>使用方法</strong></p> <p>1.下载并解压得到unzip.php文件,用文本编辑器打开(不能使用Windows自带的记事本,推荐<a href="http://down.chinaz.com/soft/18954.htm" target="_blank"><font color="#1c3d72">Notepad2</font></a>),在这个文件的头部找到</p> <blockquote> <p>&lt;?php</p> <p>//设定密码</p> <p>$password = “www.eincy.com”;</p> <p>?&gt;</p> </blockquote> <p>修改密码后保存。</p> <p>2.上传unzip.php到服务器并运行它。</p> <p style="TEXT-ALIGN: center"><img border="0" src="http://www.webjx.com/files/allimg/110828/2034110.jpg" width="600" height="172" alt=""></p> <p>3.选择zip文件,你可以选择在unzip.php同目录下的zip文件,或者上传一个zip文件。</p> <p>4.输入你准备解压这个zip文件的目录,如果留空,则表示在当前目录下解压。</p> <p>5.输入第一步中设定的密码,然后点击解压。</p> <p>文件下载地址:<a href="http://www.eincy.com/wp-content/plugins/download-monitor/download.php?id=53" target="_blank"><font color="#1c3d72">unzip.zip (6)</font></a></p>

    Read more +
  • 13

    2019-04
    PHP的问题:全面阐述PHP网站设计的问题

    <p> </p> <table style="BORDER-RIGHT: #cccccc 1px dotted; TABLE-LAYOUT: fixed; BORDER-TOP: #cccccc 1px dotted; BORDER-LEFT: #cccccc 1px dotted; BORDER-BOTTOM: #cccccc 1px dotted" cellspacing="0" cellpadding="6" width="95%" align="center" border="0"><tbody><tr> <td style="WORD-WRAP: break-word" bgcolor="#fdfddf"> <font color="#ff0000">WebjxCom提示:</font><font color="#000000">php让人难堪。它是如此的破碎,但那些被培训的业余爱好者,却对它称赞不已。php在做一些徽不足道的挽回措施,但我选择忘记它。</font> </td> </tr></tbody></table> <p><strong>前言</strong></p> <p>我的脾气古怪。我会抱怨很多东西。这个星球上大多数技术我都不喜欢。</p> <p>PHP不仅使用起来尴尬,还有要嘛我想要的不适合,要嘛不是最令人满意,要嘛违背我的信仰。我可以告诉你关于一门语言,所有我想避免的好方式,所有我喜欢的坏方式。来吧,问吧!谈话会很有趣!</p> <p>php是唯一的例外。几乎php抽象的所有东西都是支离破碎的。包括语言,框架,整个生态系统都一塌糊涂。我几乎不能单独列出咒骂的事情,因为它全身都坏了。每次我打算编辑一堆杂乱如麻的php抱怨清单的时候,我都被一些琐事打乱,越深入就越会发现其它令人震惊的事情。</p> <p>php让人难堪。它是如此的破碎,但那些被培训的业余爱好者,却对它称赞不已。php在做一些徽不足道的挽回措施,但我选择忘记它。</p> <p>不过我得让我的系统摆脱这些东西,也就这样了,这是最后一次尝试。</p> <p><strong>打个比喻</strong></p> <p>我只是随口和Mel抱怨下,而她却坚决让我发表出来。</p> <p>我甚至说不出来PHP到底怎么了,因为&#8212;还好。想想你有一个,嗯,工具箱吧。一堆工具。看起来还好,有标准的东西。</p> <p>你拔除螺丝钉,它怪异的有三个头。OK,好吧,这对你不太有用,但你猜迟早有天会有用。</p> <p>你拿出榔头,被震住了,两边都有是尖爪。但它仍然能用,我的意思是,你可以用两头的中部斜着敲。</p> <p>你拿出老虎钳,但它们没有锯齿面。表面平而光滑。这没多大用,但依然能用,没什么。</p> <p>你可以继续。工具箱的东西都是怪异和琢磨不定的,但又不能说毫无价值。整体看没什么大问题;它的工具都齐全。</p> <p>现在,想象有很多使用这些工具的木匠,它们和你说:”这些工具有什么问题呢?我们都用过,它们工作都很好啊!”。工匠们给你展示他们建的房子,每个门都是五边形的而屋顶是癫倒的。你敲前门,它向内倒榻了,而他们却抱怨你打破了他们的门。</p> <p>这就是PHP的问题。</p> <p><strong>立场</strong></p> <p>我认为下面的特质对于一门语言的生产力和可用性是重要的,而PHP在大范围破坏它们。如果你不同意这些,好吧,我无法想像,我们永远不会达成一致。</p> <p>一门语言必须是可预见的。它是</p>

    Read more +
  • 13

    2019-04
    .htaccess文件玩转Rewrite

    <p> </p> <table style="BORDER-RIGHT: #cccccc 1px dotted; TABLE-LAYOUT: fixed; BORDER-TOP: #cccccc 1px dotted; BORDER-LEFT: #cccccc 1px dotted; BORDER-BOTTOM: #cccccc 1px dotted" cellspacing="0" cellpadding="6" width="95%" align="center" border="0"><tbody><tr> <td style="WORD-WRAP: break-word" bgcolor="#fdfddf"> <font color="#ff0000">WebjxCom提示:</font><font color="#000000">.htaccess文件玩转Rewrite.</font> </td> </tr></tbody></table> <p>刚玩网页的时候,写的都是静态页 http://uicss.cn/about.htm 这样的结构。<br>后来想换成 http://uicss.cn/about/<br>但是又因为不熟悉rewrite,做了如下的调整,手动建立了一堆的文件夹:</p> <p><img class="aligncenter size-full wp-image-14722" title="mysite" alt="" src="http://www.webjx.com/files/allimg/120625/0114380.png" width="367" height="221"></p> <p>这样的目录结构,维护起来相当麻烦。每次新加一个页面,都要开一个文件夹。<br>其实采用左边那套结构部署上去,服务器稍做设置,就可以支持我们想要的URL效果。</p> <h5>如何玩 rewrite </h5> <p>首先看看自己的服务器是否支持 .htaccess<br>如果支持这货,就不用每次写条规则就重启一次服务器了,便于测试。</p> <p><code><font face="NSimsun">redirect 301 /test.htm http://uicss.cn/</font></code></p> <p>成功的话,当你访问 xxx.com/test.htm 的时候,会自动跳到我的博客。<br>不成功的话,需要开启一下 .htaccess :</p> <ol> <li>打开 \conf\httpd.conf ,查找 <strong class="red">#</strong>LoadModule rewrite_module,将#号去掉,加载该模块 </li> <li>打开 \conf\extra\httpd-vhosts.conf ,查找 AllowOverride <strong class="red">None</strong>,将 None 变更为 All </li> </ol> <p>环境准备完成后,还需要对“模式匹配”中特殊字符在rewrite的解读做一下了解:</p> <p><code><font face="NSimsun">* 代表前面0或更多个字符<br>+ 代表前面1或更多个字符<br>? 代表前面0或1个字符<br>^ 代表字符串的开始位置<br>^ 在方括号里代表“非”,例如[^/]代表非斜杠。<br>$ 代表字符串结束的位置<br>. 代表任何字符(也就是通配符)<br>\ 取消后面字符的特殊意思,转为原义字符。<br><span class="float_right">&#8212;&#8212; 这部分的理解出自《SEO艺术》第六章末</span><br></font></code></p> <p>开始干吧,打开.htaccess的rewrite<br><code><font face="NSimsun">RewriteEngine on</font></code></p> <p>把 xxx.htm 文件 替换为 xxx/<br><code><font face="NSimsun">RewriteRule ^(.*)\<strong class="red">/</strong>$ /$1.htm [L]</font></code></p> <p>再给一个例子加深理解,这是将服务器上的 xxx.php 文件 替换成 xxx.html<br><font face="NSimsun"><code>RewriteRule ^(.*)\<strong class="red">.html</strong>$ /$1.php [L]</code><br><span id="more-14719"></span></font></p> <h5>更多用法:</h5> <p>让所有访问 www.uicss.cn/xxx/ 的用户 跳转到 uicss.cn/xxx/<br><code><font face="NSimsun">RewriteCond %{HTTP_HOST} ^www.uicss.cn [NC]<br>RewriteRule ^(.*)$ http://uicss.cn/$1 [L,R=301]</font></code></p> <p>对指定目录开启转向的代码:<br><code><font face="NSimsun">RewriteBase /top/</font></code></p> <p>带搜索参数的转向:<br><code><font face="NSimsun">RewriteRule ^search/(.+)?$ /index.php?s=$1 [QSA,L]</font></code></p> <p>目录末尾补斜线:<br><code><font face="NSimsun">RewriteRule ^(.+[^/])$ /$1/ [R]</font></code></p>

    Read more +
  • 13

    2019-04
    PHP实例代码:模仿百度搜索时输入内容带提示

    <p> </p> <table style="BORDER-RIGHT: #cccccc 1px dotted; TABLE-LAYOUT: fixed; BORDER-TOP: #cccccc 1px dotted; BORDER-LEFT: #cccccc 1px dotted; BORDER-BOTTOM: #cccccc 1px dotted" cellspacing="0" cellpadding="6" width="95%" align="center" border="0"><tbody><tr> <td style="WORD-WRAP: break-word" bgcolor="#fdfddf"> <font color="#ff0000">WebjxCom提示:</font><font color="#000000">PHP+JS模仿的百度搜索输入提示功能.</font> </td> </tr></tbody></table> <p>自己用PHP + js模仿的百度搜索时输入内容带提示的功能,运行的话需要PHP环境。也算是自己的一个练笔题吧,和大家分享一下</p> <p>&lt;?php<br>&#160;&#160;&#160;&#160;&#160;&#160;&#160; $aName = array("王成","王瑞","王祥","何武昌","何睿","何好","马兴","马成栋","张相","张祥");<br>&#160;&#160;&#160;&#160;&#160;&#160;&#160; $aId = array(88801,11144,2345,9023,12415,88021,11145,2344,11145,0376);<br>&#160;&#160;&#160;&#160;&#160;&#160;&#160; foreach($aName as $k =&gt;$val)<br>&#160;&#160;&#160;&#160;&#160;&#160;&#160; {<br>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; $json[$k] = array(<br>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; 'id' =&gt; $aId[$k],<br>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; 'name' =&gt; $val<br>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; );&#160;&#160;&#160;&#160;&#160;&#160;&#160; <br>&#160;&#160;&#160;&#160;&#160;&#160;&#160; }</p> <p>/**************************************************************<br>*<br>*&#160; 使用特定function对数组中所有元素做处理<br>*&#160; @param&#160; string&#160; &amp;$array&#160;&#160;&#160;&#160; 要处理的字符串<br>*&#160; @param&#160; string&#160; $function&#160;&#160; 要执行的函数<br>*&#160; @return boolean $apply_to_keys_also&#160;&#160;&#160;&#160; 是否也应用到key上<br>*&#160; @access public<br>*<br>*************************************************************/<br>function arrayRecursive(&amp;$array, $function, $apply_to_keys_also = false)<br>{<br>&#160;&#160;&#160; static $recursive_counter = 0;<br>&#160;&#160;&#160; if (++$recursive_counter &gt; 1000) {<br>&#160;&#160;&#160;&#160;&#160;&#160;&#160; die('possible deep recursion attack');<br>&#160;&#160;&#160; }<br>&#160;&#160;&#160; foreach ($array as $key =&gt; $value) {<br>&#160;&#160;&#160;&#160;&#160;&#160;&#160; if (is_array($value)) {<br>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; arrayRecursive($array[$key], $function, $apply_to_keys_also);<br>&#160;&#160;&#160;&#160;&#160;&#160;&#160; } else {<br>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; $array[$key] = $function($value);<br>&#160;&#160;&#160;&#160;&#160;&#160;&#160; }<br>&#160;&#160;&#160;&#160;&#160;&#160;&#160; if ($apply_to_keys_also &amp;&amp; is_string($key)) {<br>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; $new_key = $function($key);<br>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; if ($new_key != $key) {<br>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; $array[$new_key] = $array[$key];<br>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; unset($array[$key]);<br>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; }<br>&#160;&#160;&#160;&#160;&#160;&#160;&#160; }<br>&#160;&#160;&#160; }<br>&#160;&#160;&#160; $recursive_counter--;<br>}<br>/**************************************************************<br>*<br>*&#160; 将数组转换为JSON字符串(兼容中文)<br>*&#160; @param&#160; array&#160;&#160; $array&#160;&#160;&#160;&#160;&#160; 要转换的数组<br>*&#160; @return string&#160;&#160;&#160;&#160;&#160; 转换得到的json字符串<br>*&#160; @access public<br>*<br>*************************************************************/<br>function JSON($array) {<br>&#160;&#160;&#160; arrayRecursive($array, 'urlencode', true);<br>&#160;&#160;&#160; $json = json_encode($array);<br>&#160;&#160;&#160; return urldecode($json);<br>}<br>?&gt;<br>&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;<br>&lt;html xmlns="http://www.w3.org/1999/xhtml"&gt;<br>&lt;head&gt;<br>&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;meta content="text/html;charset=gb2312" http-equiv="content-type" /&gt;<br>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;style type="text/css"&gt;<br>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; .name{cursor:pointer;}<br>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; .selected{background:#CCC;}<br>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; .normal{background:#FFF;}<br>&#160;&#160;&#160; &lt;/style&gt;<br>&lt;/head&gt;<br>&lt;table align="center"&gt;<br>&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;tr&gt;<br>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;td&gt;输入测试:&lt;/td&gt;<br>&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;td&gt;&lt;input type="text" style="color:" id="neirong" onkeyup="tip(event,0)"/&gt;&lt;/td&gt;<br>&#160;&#160;&#160; &lt;/tr&gt;<br>&lt;/table&gt;<br>&lt;div id="showMessage" style="border:1px #666 solid;"&gt;<br>&lt;/div&gt;<br>&lt;script type="text/javascript"&gt;<br>&#160;&#160;&#160;&#160;&#160;&#160;&#160; window.onload = function(){<br>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; var tag = document.getElementById("showMessage");<br>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; tag.style.display = "none";<br>&#160;&#160;&#160;&#160;&#160;&#160;&#160; }<br>&#160;&#160;&#160;&#160;&#160;&#160;&#160; function tip(event) {<br>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; var aUserName = new Array();<br>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; var aTempName, aUserName, tag, sVal, sHtml, mesTag, selectedTag, didTag, widths;<br>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; var postion = new Array();<br>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; var sId = 0;//用于给每个名字加一个id的顺序<br>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; var whichType;//用户输入的类型,是数字呢还是中文。<br>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; aUserName = &lt;?php echo JSON($json); ?&gt;;<br>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; //aUserName = eval('(' + aTempName + ')');<br>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; tag = document.getElementById("neirong");<br>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; didTag = document.getElementById("did");<br>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; //输入框坐标获取<br>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; postion = getElementPos(tag);<br>&#160;&#160;&#160;&#160;&#160;&#160;&#160; <br>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; //显示div坐标调整<br>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; mesTag = document.getElementById("showMessage");<br>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; mesTag.style.position = "absolute";<br>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; mesTag.style.left = postion[0]<br>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; mesTag.style.top = postion[1];<br>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; widths = tag.style.width + "px";<br>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; mesTag.width = widths;<br>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; var event = event || window.event;<br>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; var sKeyCode = event.keyCode;<br>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; var aShangXia = new Array(37,38,39,40);<br>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; var isDerection;<br>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; sVal = tag.value;<br>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; //以enter作为用户输入结束标志<br>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; if(13!=sKeyCode) {<br>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; for(var i in aShangXia) {<br>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; if(sKeyCode == aShangXia) {<br>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; isDerection = false;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <br>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; break;<br>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; }&#160;&#160;&#160;&#160;&#160;&#160;&#160; <br>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; else {<br>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; isDerection = true;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <br>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; }<br>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; }<br>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; if(isDerection) {<br>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; sHtml = '';<br>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; if(""==sVal) {<br>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; mesTag.style.display = "none";<br>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; mesTag.innerHTML = sHtml;<br>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; return false;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <br>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; }<br>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; else {&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <br>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; sHtml = '&lt;table width="146px" border="0" id="showTable"&gt;';<br>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; if(checkVal(sVal)) {<br>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; for(var i in aUserName)<br>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; {<br>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; if(0&lt;=aUserName[i].id.indexOf(sVal)) {<br>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; sHtml = sHtml + '&lt;tr&gt;&lt;td class="normal" onclick="clickToChoice('+sId+')" onmouseover="changeColor(true,'+sId+')" onmouseout="changeColor(false,'+sId+')" id="p_'+sId+'" readonly="readonly"&gt;'+aUserName[i].id+'_'+aUserName[i].name+'&lt;/td&gt;&lt;/tr&gt;';<br>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; sId = sId + 1;<br>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; }<br>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; }&#160;&#160;&#160;&#160;&#160;&#160;&#160; <br>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; }<br>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; else {<br>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; for(var i in aUserName)<br>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; {&#160;&#160;&#160;&#160;&#160;&#160;&#160; <br>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; if(0&lt;=aUserName[i].name.indexOf(sVal)) {<br>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; sHtml = sHtml + '&lt;tr&gt;&lt;td class="normal" onclick="clickToChoice('+sId+')" onmouseover="changeColor(true,'+sId+')" onmouseout="changeColor(false,'+sId+')" id="p_'+sId+'" readonly="readonly"&gt;'+aUserName[i].id+'_'+aUserName[i].name+'&lt;/td&gt;&lt;/tr&gt;';<br>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; sId = sId + 1;<br>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; }<br>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; }<br>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; }<br>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; sHtml = sHtml + '&lt;/table&gt;';<br>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; if(0!=sId) {&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <br>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; mesTag.style.display = "";<br>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; mesTag.innerHTML = sHtml;<br>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; sHtml = '';&#160;&#160;&#160;&#160;&#160;&#160;&#160; <br>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; }<br>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; else {<br>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; mesTag.innerHTML = '没有结果';&#160;&#160;&#160;&#160;&#160;&#160;&#160; <br>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; }<br>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; }<br>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; }<br>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; else<br>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; {<br>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; if(38==sKeyCode||40==sKeyCode) {<br>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; dance(sKeyCode,sVal,tag);<br>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; }&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <br>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; }&#160;&#160;&#160;&#160;&#160;&#160;&#160; <br>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; }<br>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; else {<br>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; if(''!=tag.value) {<br>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; mesTag.innerHTML = '';<br>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; showMessage.style.display = 'none';<br>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; }<br>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; else {<br>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; return false;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <br>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; }&#160;&#160;&#160;&#160;&#160;&#160;&#160; <br>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; }<br>&#160;&#160;&#160;&#160;&#160;&#160;&#160; }</p> <p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; function checkVal(sVal){<br>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; var patrn = /^[0-9]/;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <br>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; if(patrn.exec(sVal)) {<br>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; return true;<br>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; }<br>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; else {<br>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; return false;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <br>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; }<br>&#160;&#160;&#160;&#160;&#160;&#160;&#160; }<br>&#160;&#160;&#160;&#160;&#160;&#160;&#160; //获取用户通过点击的名字<br>&#160;&#160;&#160;&#160;&#160;&#160;&#160; function clickToChoice(sqnm) {<br>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; var choicedTag, mesTag, showTag;<br>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; choicedTag = document.getElementById("p_"+sqnm);<br>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; mesTag = document.getElementById("neirong");<br>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; showTag = document.getElementById("showTable");<br>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; mesTag.value = choicedTag.innerHTML; <br>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; showMessage.style.display = 'none';<br>&#160;&#160;&#160;&#160;&#160;&#160;&#160; }<br>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <br>&#160;&#160;&#160;&#160;&#160;&#160;&#160; function dance(sKeyCode,sVal,tag) {<br>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; var danceTag = getElementsByClassName("normal");//这个是正常的行<br>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; var danceingTag = getElementsByClassName("selected");//这个是前一个被选中的行<br>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; var selectedTag, lastTag, showTag, selectedVal, currentNum, initial;<br>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; var rowNums, selectedNum = 0;<br>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; var danceLen = danceTag.length;<br>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; if(0 != danceingTag.length) {<br>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; showTag = document.getElementById("showTable");<br>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; rowNums = showTag.rows.length;<br>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; currentNum = danceingTag[0].id.split("_")[1] * 1;<br>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; switch(sKeyCode) {<br>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; case 40:<br>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; if(rowNums == (currentNum + 1)) {<br>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; selectedNum = 0;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <br>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; }&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <br>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; else {<br>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; selectedNum = currentNum + 1;<br>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; }<br>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; break;<br>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; case 38:<br>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; if(0 == currentNum ) {<br>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; selectedNum = rowNums - 1;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <br>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; }&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <br>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; else {<br>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; selectedNum = currentNum - 1;<br>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; }<br>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; break;<br>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; }<br>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; }<br>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; else {<br>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; switch(sKeyCode) {<br>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; case 40:<br>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; currentNum = danceTag.length - 1;<br>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; selectedNum = 0;<br>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; break;<br>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; case 38:<br>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; currentNum = 0;<br>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; selectedNum = danceTag.length - 1;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <br>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; break;<br>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; }&#160;&#160;&#160;&#160;&#160;&#160;&#160; <br>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; }<br>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <br>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; lastTag&#160;&#160;&#160;&#160;&#160;&#160;&#160; = document.getElementById("p_"+currentNum);&#160;&#160;&#160;&#160;&#160;&#160;&#160; <br>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; lastTag.className = "normal";<br>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; selectedTag = document.getElementById("p_"+selectedNum);&#160;&#160;&#160;&#160;&#160;&#160;&#160; <br>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; selectedVal = selectedTag.innerHTML;<br>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; selectedTag.className = "selected";<br>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; tag.value = selectedVal;<br>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <br>&#160;&#160;&#160;&#160;&#160;&#160;&#160; }<br>&#160;&#160;&#160;&#160;&#160;&#160;&#160; function changeColor(type,sqnm) {<br>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; var tag = document.getElementById("p_"+sqnm);<br>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; if(type) {<br>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; tag.className = "selected";<br>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; }<br>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; else {<br>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; tag.className = "normal";&#160;&#160;&#160;&#160;&#160;&#160;&#160; <br>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; }&#160;&#160;&#160;&#160;&#160;&#160;&#160; <br>&#160;&#160;&#160;&#160;&#160;&#160;&#160; }<br>&#160;&#160;&#160;&#160;&#160;&#160;&#160; <br>&#160;&#160;&#160;&#160;&#160;&#160;&#160; function getElementsByClassName(n) {<br>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; var classElements = [],allElements = document.getElementsByTagName('*');<br>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; for (var i=0; i&lt; allElements.length; i++ )<br>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; {<br>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; if (allElements[i].className == n ) {<br>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; classElements[classElements.length] = allElements[i]; //某类集合<br>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; }<br>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; }<br>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; return classElements;<br>&#160;&#160;&#160;&#160;&#160;&#160;&#160; }</p> <p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; <br>&#160;&#160;&#160;&#160;&#160;&#160;&#160; function getElementPos(tag) {<br>&#160;&#160;&#160;&#160;&#160;&#160;&

    Read more +
  • 13

    2019-04
    实例学习Apache服务器的安全防护知识

    <p> </p> <table style="BORDER-RIGHT: #cccccc 1px dotted; TABLE-LAYOUT: fixed; BORDER-TOP: #cccccc 1px dotted; BORDER-LEFT: #cccccc 1px dotted; BORDER-BOTTOM: #cccccc 1px dotted" cellspacing="0" cellpadding="6" width="95%" align="center" border="0"><tbody><tr> <td style="WORD-WRAP: break-word" bgcolor="#fdfddf"> <font color="#ff0000">WebjxCom提示:</font><font color="#000000">开源 Apache 服务器安全防护技术精要及实战.</font> </td> </tr></tbody></table> <p style='font: 14px/26px "Segoe UI", Tahoma, Arial; margin: 1em 0px; padding: 0px; color: rgb(0, 0, 0); text-transform: none; text-indent: 2em; letter-spacing: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(245, 250, 255); -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px;'>Apache 一直是世界上使用率排名前三的 Web 服务器软件。企业使用其构建 Web 应用,从很大程度上都需要对其安全性进行综合考虑,以保证能够应对拒绝服务攻击、流量窃听、数据泄漏等网络威胁,从而保证企业门户网站的安全。除了使用业界流行的防火墙、IDS/IPS(入侵检测系统 / 入侵防御系统)、WAF(Web 应用防火墙)、UTM(统一威胁管理)等外部安全设备对 Apache 服务进行安全防护外,作为一种优秀的开源服务器软件,Apache 本身就具有很多优秀的特性可以为服务器管理员提供安全配置,以防范各种网络攻击。因此,充分、高效地挖掘 Apache 服务器的自身安全能力也是企业安全工作者一个必备的技能。基于此,本文将通过大量的实例,从服务器安全设置、运行环境安全保障、安全模块保护、日志管理等 6 个方面详细剖析 Apache 服务器的安全防护要点。</p> <h2 id="major1" style='margin: 1em 0px; padding: 0px; color: rgb(0, 0, 0); text-transform: none; text-indent: 0px; letter-spacing: normal; font-family: "Segoe UI", Tahoma, Arial; font-size: 18px; font-style: normal; font-variant: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(245, 250, 255); -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px;'><strong>Apache 服务简介</strong></h2> <p style='font: 14px/26px "Segoe UI", Tahoma, Arial; margin: 1em 0px; padding: 0px; color: rgb(0, 0, 0); text-transform: none; text-indent: 2em; letter-spacing: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(245, 250, 255); -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px;'>Web 服务器也称为 WWW 服务器或 HTTP 服务器 (HTTP Server),它是 Internet 上最常见也是使用最频繁的服务器之一,Web 服务器能够为用户提供网页浏览、论坛访问等等服务。</p> <p style='font: 14px/26px "Segoe UI", Tahoma, Arial; margin: 1em 0px; padding: 0px; color: rgb(0, 0, 0); text-transform: none; text-indent: 2em; letter-spacing: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(245, 250, 255); -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px;'>由于用户在通过 Web 浏览器访问信息资源的过程中,无须再关心一些技术性的细节,而且界面非常友好,因而 Web 在 Internet 上一推出就得到了爆炸性的发展。现在 Web 服务器已经成为 Internet 上最大的计算机群,Web 文档之多、链接的网络之广,也令人难以想像。因此,Web 服务器软件的数量也开始增加,Web 服务器软件市场的竞争也越来越激烈。本文所讨论的就是一款最常用的 Web 服务器软件&#8212;&#8212; Apache。</p> <p style='font: 14px/26px "Segoe UI", Tahoma, Arial; margin: 1em 0px; padding: 0px; color: rgb(0, 0, 0); text-transform: none; text-indent: 2em; letter-spacing: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(245, 250, 255); -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px;'>Apache 是一个免费的软件,用户可以免费从 Apache 的官方网站下载。任何人都可以参加其组成部分的开发。Apache 允许世界各地的人对其提供新特性。当新代码提交到 Apache Group 后,Apache Group 对其具体内容进行审查并测试和质量检查。如果他们满意,该代码就会被集成到 Apache 的主要发行版本中。</p> <p style='font: 14px/26px "Segoe UI", Tahoma, Arial; margin: 1em 0px; padding: 0px; color: rgb(0, 0, 0); text-transform: none; text-indent: 2em; letter-spacing: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(245, 250, 255); -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px;'>Apache 的其他主要特征有:</p> <ul style='font: 14px/26px "Segoe UI", Tahoma, Arial; margin: 1em 0px; padding: 0px 0px 0px 30px; color: rgb(0, 0, 0); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; list-style-type: disc; white-space: normal; orphans: 2; widows: 2; background-color: rgb(245, 250, 255); -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px;'> <li style="list-style: inherit; margin: 0px 0px 5px; padding: 0px;">支持最新的 HTTP 协议:是最先支持 HTTP1.1 的 Web 服务器之一,其与新的 HTTP 协议完全兼容,同时与 HTTP1.0、HTTP1.1 向后兼容。Apache 还为支持新协议做好了准备。</li> <li style="list-style: inherit; margin: 0px 0px 5px; padding: 0px;">简单而强大的基于文件的配置:该服务器没有为管理员提供图形用户界面,提供了三个简单但是功能异常强大的配置文件。用户可以根据需要用这三个文件随心所欲地完成自己希望的 Apache 配置。</li> <li style="list-style: inherit; margin: 0px 0px 5px; padding: 0px;">支持通用网关接口(CGI):采用 mod_cgi 模块支持 CGI。Apache 支持 CGI/1.1 标准,并且提供了一些扩充。</li> <li style="list-style: inherit; margin: 0px 0px 5px; padding: 0px;">支持虚拟主机:是首批既支持 IP 虚拟主机又支持命名虚拟主机的 Web 服务器之一。</li> <li style="list-style: inherit; margin: 0px 0px 5px; padding: 0px;">支持 HTTP 认证:支持基于 Web 的基本认证。它还有望支持基于消息摘要的认证。</li> <li style="list-style: inherit; margin: 0px 0px 5px; padding: 0px;">内部集成 Perl:Perl 是 CGI 脚本编程的事实标准。Apache 对 Perl 提供了良好的支持,通过使用其 mod_perl 模块,还可以将 Perl 的脚本装入内存。</li> <li style="list-style: inherit; margin: 0px 0px 5px; padding: 0px;">集成代理服务器:用户还可以选择 Apache 作为代理服务器。</li> <li style="list-style: inherit; margin: 0px 0px 5px; padding: 0px;">支持 SSL:由于版本法和美国法律在进出口方面的限制,Apache 本身不支持 SSL。但是用户可以通过安装 Apache 的补丁程序集合(Apache-SSL)使得 Apache 支持 SSL。</li> <li style="list-style: inherit; margin: 0px 0px 5px; padding: 0px;">支持 HTTP Cookie:通过支持 Cookie,可以对用户浏览 Web 站点进行跟踪。</li> </ul> <div style='font: 14px/26px "Segoe UI", Tahoma, Arial; margin: 0px; padding: 0px; color: rgb(0, 0, 0); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(245, 250, 255); -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px;'> <h2 id="major2" style="margin: 1em 0px; padding: 0px; font-size: 18px;"><strong>Apache 服务面临的网络威胁</strong></h2> <p style="margin: 1em 0px; padding: 0px; text-indent: 2em;">一般说来,Apache 服务器主要面临如下几种网络威胁:</p> <ol type="1" style="margin: 1em 0px; padding: 0px 0px 0px 30px; list-style-type: decimal;"> <li style="list-style: inherit; margin: 0px 0px 5px; padding: 0px;">使用 HTTP 协议进行的拒绝服务攻击:攻击者会通过某些手段使服务器拒绝对 HTIP 应答。这样会使 Apache 对系统资源(CPU 时间和内存)需求巨增,造成 Apache 系统变慢甚至完全瘫痪,从而引起 HTTP 服务的中断或者合法用户的合法请求得不到及时地响应;</li> <li style="list-style: inherit; margin: 0px 0px 5px; padding: 0px;">缓冲区溢出攻击:由于 Apache 源代码完全开放,攻击者就可以利用程序编写的一些缺陷,使程序偏离正常流程。程序使用静态分配的内存保存请求数据,攻击者就可以发送一个超长请求使缓冲区溢出,从而导致缓冲区溢出攻击;</li> <li style="list-style: inherit; margin: 0px 0px 5px; padding: 0px;">被攻击者获得 root 权限,威胁系统安全:由于 Apache 服务器一般以 root 权限运行,攻击者通过它获得 root 权限,进而控制整个 Apache 系统;</li> <li style="list-style: inherit; margin: 0px 0px 5px; padding: 0px;">Apache 服务器与客户端通信安全:如果采用明文传输,则服务器与客户端的敏感通信信息将有可能被黑客或者不法用户获取;</li> <li style="list-style: inherit; margin: 0px 0px 5px; padding: 0px;">由于 Apache 配置文件设置不当引起的安全问题:恶意者可以随意下载或修改删除系统文件。这主要涉及到对访问者的内容和权限的限制。</li> </ol> <p style="margin: 1em 0px; padding: 0px; text-indent: 2em;">要应对上述这些安全威胁,要从 Apache 服务器端配置、运行环境、通信链路安全保障、安全模块使用、日志管理等各方面、全方位的进行保障,下面将进行分门别类的详细介绍。</p> <h2 id="major3" style="margin: 1em 0px; padding: 0px; font-size: 18px;"><strong>Apache 服务器端安全设置</strong></h2> <h3 id="minor3.1" style="margin: 1em 0px; padding: 0px; font-size: 18px;"><strong>限制 root 用户运行 Apache 服务器</strong></h3> <p style="margin: 1em 0px; padding: 0px; text-indent: 2em;">一般情况下,在 Linux 下启动 Apache 服务器的进程 httpd 需要 root 权限。由于 root 权限太大,存在许多潜在的对系统的安全威胁。一些管理员为了安全的原因,认为 httpd 服务器不可能没有安全漏洞,因而更愿意使用普通用户的权限来启动服务器。http.conf 主配置文件里面有如下 2 个配置是 Apache 的安全保证,Apache 在启动之后,就将其本身设置为这两个选项设置的用户和组权限进行运行,这样就降低了服务器的危险性。</p> <p style="margin: 1em 0px; padding: 0px; text-indent: 2em;">User apache</p> <p style="margin: 1em 0px; padding: 0px; text-indent: 2em;">Group apache</p> <p style="margin: 1em 0px; padding: 0px; text-indent: 2em;">需要特别指出的是:以上 2 个配置在主配置文件里面是默认选项,当采用 root 用户身份运行 httpd 进程后,系统将自动将该进程的用户组和权限改为 apache,这样,httpd 进程的权限就被限制在 apache 用户和组范围内,因而保证了安全。</p> <h3 id="minor3.2" style="margin: 1em 0px; padding: 0px; font-size: 18px;"><strong>向客户端隐藏 Apache 服务器的相关信息</strong></h3> <p style="margin: 1em 0px; padding: 0px; text-indent: 2em;">Apache 服务器的版本号可以作为黑客入侵的重要信息进行利用,他们通常在获得版本号后,通过网上搜索针对该版本服务器的漏洞,从而使用相应的技术和工具有针对性的入侵,这也是渗透测试的一个关键步骤。因此,为了避免一些不必要的麻烦和安全隐患,可以通过主配置文件 httpd.conf 下的如下两个选项进行:</p> <p style="margin: 1em 0px; padding: 0px; text-indent: 2em;">(1)ServerTokens:该选项用于控制服务器是否响应来自客户端的请求,向客户端输出服务器系统类型或者相应的内置模块等重要信息。Red Hat Enterprise Linux 5 操作系统在主配置文件中提供全局默认控制阈值为 OS,即 ServerTokens OS。它们将向客户端公开操作系统信息和相关敏感信息,所以保证安全情况下需要在该选项后使用“ProductOnly”,即 ServerTokens ProductOnly。</p> <p style="margin: 1em 0px; padding: 0px; text-indent: 2em;">(2)ServerSignature:该选项控制由系统生成的页面(错误信息等)。默认情况下为 off,即 ServerSignature off,该情况下不输出任何页面信息。另一情况为 on,即 ServerSignature on,该情况下输出一行关于版本号等相关信息。安全情况下应该将其状态设为 off。</p> <p style="margin: 1em 0px; padding: 0px; text-indent: 2em;">图 1 和图 2 为安全设定这两个选项前后正常情况下和错误情况下的输出页面(通过 Rhel5 中的 Mozilla Firefox 浏览器访问 Rhel5 中的 Apache 服务器)的详细对比。可以清楚看到,安全设定选项后,可以充分地向客户端用户隐藏 Linux 操作系统信息和 Apache 服务器版本信息。</p> <p style="margin: 1em 0px; padding: 0px; text-indent: 2em;">图 1. 错误情况下未设定安全选项前示意</p> <p style="margin: 1em 0px; padding: 0px; text-indent: 2em;"><a title="开源 Apache 服务器安全防护技术精要及实战" class="cboxElement" style="color: rgb(28, 61, 114); text-decoration: none;" href="http://upload.chinaz.com/2013/1017/1381977512685.jpg" rel="lightbox[49548]"><img title="" class="alignnone size-full wp-image-49549" style="border: 1px solid rgb(153, 153, 153); margin-right: auto; margin-left: auto; display: block;" alt="iimage001" src="http://www.webjx.com/files/allimg/131017/2050370.jpg" border="0"></a></p> <p style="margin: 1em 0px; padding: 0px; text-indent: 2em;">图 2. 操作情况下使用安全设定后的对比</p> <p style="margin: 1em 0px; padding: 0px; text-indent: 2em;"><a title="开源 Apache 服务器安全防护技术精要及实战" class="cboxElement" style="color: rgb(28, 61, 114); text-decoration: none;" href="http://upload.chinaz.com/2013/1017/1381977512386.jpg" rel="lightbox[49548]"><img title="" class="alignnone size-full wp-image-49550" style="border: 1px solid rgb(153, 153, 153); margin-right: auto; margin-left: auto; display: block;" alt="iimage002" src="http://www.webjx.com/files/allimg/131017/2050371.jpg" border="0"></a></p> <h3 id="minor3.3" style="margin: 1em 0px; padding: 0px; font-size: 18px;"><strong>设置虚拟目录和目录权限</strong></h3> <p style="margin: 1em 0px; padding: 0px; text-indent: 2em;">要从主目录以外的其他目录中进行发布,就必须创建虚拟目录。虚拟目录是一个位于 Apache 的主目录外的目录,它不包含在 Apache 的主目录中,但在访问 Web 站点的用户看来,它与位于主目录中的子目录是一样的。每个虚拟目录都有一个别名,用户 Web 浏览器中可以通过此别名来访问虚拟目录,如 http:// 服务器 IP 地址 / 别名 / 文件名,就可以访问虚拟目录下面的任何文件了。</p> <p style="margin: 1em 0px; padding: 0px; text-indent: 2em;">使用 Alias 选项可以创建虚拟目录。在主配置文件中,Apache 默认已经创建了两个虚拟目录。这两条语句分别建立了“/icons/”和“/manual”两个虚拟目录,它们对应的物理路径分别是“/var/www/icons/”和“/var/www/manual”。在主配置文件中,用户可以看到如下配置语句:</p> <div style="margin: 0px; padding: 0px;"> <div class="syntaxhighlighter notranslate shell ie" id="highlighter_889355" style="margin: 0px; padding: 0px;"> <table style="width: 641px; border-collapse: collapse; border-spacing: 0px; background-color: rgb(255, 255, 255);" border="0" cellspacing="0" cellpadding="0"><tbody><tr> <td class="gutter" style="margin: 0px; padding: 5px; border: 1px solid rgb(221, 221, 221);"> <div class="line number1 index0 alt2" style="margin: 0px 10px 10px; padding: 0px;">1</div> <div class="line number2 index1 alt1" style="margin: 0px 10px 10px; padding: 0px;">2</div> <div class="line number3 index2 alt2" style="margin: 0px 10px 10px; padding: 0px;">3</div> </td> <td class="code" style="margin: 0px; padding: 5px; border: 1px solid rgb(221, 221, 221);"> <div class="container" style="margin: auto; padding: 0px; width: 539.96px; overflow: hidden; background-color: rgb(255, 255, 255);"> <div class="line number1 index0 alt2" style="margin: 0px 10px 10px; padding: 0px;"> <code class="shell plain" style='margin: 0px; padding: 0px; font-family: Consolas, "Courier New", monospace;'>Alias<span class="Apple-converted-space">&#160;</span></code><code class="shell plain" style='margin: 0px; padding: 0px; font-family: Consolas, "Courier New", monospace;'>/icons/</code><span class="Apple-converted-space">&#160;</span><code class="shell plain" style='margin: 0px; padding: 0px; font-family: Consolas, "Courier New", monospace;'>“</code><code class="shell plain" style='margin: 0px; padding: 0px; font-family: Consolas, "Courier New", monospace;'>/var/www/icons/</code><code class="shell plain" style='margin: 0px; padding: 0px; font-family: Consolas, "Courier New", monospace;'>”</code> </div> <div class="line number2 index1 alt1" style="margin: 0px 10px 10px; padding: 0px;"> <code class="shell spaces" style='margin: 0px; padding: 0px; font-family: Consolas, "Courier New", monospace;'>&#160;</code>&#160;</div> <div class="line number3 index2 alt2" style="margin: 0px 10px 10px; padding: 0px;"> <code class="shell plain" style='margin: 0px; padding: 0px; font-family: Consolas, "Courier New", monospace;'>Alias<span class="Apple-converted-space">&#160;</span></code><code class="shell plain" style='margin: 0px; padding: 0px; font-family: Consolas, "Courier New", monospace;'>/manual</code><span class="Apple-converted-space">&#160;</span><code class="shell plain" style='margin: 0px; padding: 0px; font-family: Consolas, "Courier New", monospace;'>“</code><code class="shell plain" style='margin: 0px; padding: 0px; font-family: Consolas, "Courier New", monospace;'>/var/www/manual</code><code class="shell plain" style='margin: 0px; padding: 0px; font-family: Consolas, "Courier New", monospace;'>”</code> </div> </div> </td> </tr></tbody></table> </div> </div> <p style="margin: 1em 0px; padding: 0px; text-indent: 2em;">在实际使用过程中,用户可以自己创建虚拟目录。比如,创建名为 /user 的虚拟目录,它所对应的路径为上面几个例子中常用的 /var/www/html/rhel5:</p> <div style="margin: 0px; padding: 0px;"> <div class="syntaxhighlighter notranslate shell ie" id="highlighter_604871" style="margin: 0px; padding: 0px;"> <table style="width: 641px; border-collapse: collapse; border-spacing: 0px; background-color: rgb(255, 255, 255);" border="0" cellspacing="0" cellpadding="0"><tbody><tr> <td class="gutter" style="margin: 0px; padding: 5px; border: 1px solid rgb(221, 221, 221);"> <div class="line number1 index0 alt2" style="margin: 0px 10px 10px; padding: 0px;">1</div> </td> <td class="code" style="margin: 0px; padding: 5px; border: 1px solid rgb(221, 221, 221);"> <div class="container" style="margin: auto; padding: 0px; width: 543.9px; overflow: hidden; background-color: rgb(255, 255, 255);"> <div class="line number1 index0 alt2" style="margin: 0px 10px 10px; padding: 0px;"> <code class="shell plain" style='margin: 0px; padding: 0px; font-family: Consolas, "Courier New", monospace;'>Alias<span class="Apple-converted-space">&#160;</span></code><code class="shell plain" style='margin: 0px; padding: 0px; font-family: Consolas, "Courier New", monospace;'>/test</code><span class="Apple-converted-space">&#160;</span><code class="shell plain" style='margin: 0px; padding: 0px; font-family: Consolas, "Courier New", monospace;'>“</code><code class="shell plain" style='margin: 0px; padding: 0px; font-family: Consolas, "Courier New", monospace;'>/var/www/html/rhel5</code><code class="shell plain" style='margin: 0px; padding: 0px; font-family: Consolas, "Courier New", monospace;'>″</code> </div> </div> </td> </tr></tbody></table> </div> </div> <p style="margin: 1em 0px; padding: 0px; text-indent: 2em;">如果需要对其进行权限设置,可以加入如下语句:</p> <div style="margin: 0px; padding: 0px;"> <div class="syntaxhighlighter notranslate xml ie" id="highlighter_881212" style="margin: 0px; padding: 0px;"> <table style="width: 641px; border-collapse: collapse; border-spacing: 0px; background-color: rgb(255, 255, 255);" border="0" cellspacing="0" cellpadding="0"><tbody><tr> <td class="gutter" style="margin: 0px; padding: 5px; border: 1px solid rgb(221, 221, 221);"> <div class="line number1 index0 alt2" style="margin: 0px 10px 10px; padding: 0px;">1</div> <div class="line number2 index1 alt1" style="margin: 0px 10px 10px; padding: 0px;">2</div> <div class="line number3 index2 alt2" style="margin: 0px 10px 10px; padding: 0px;">3</div> <div class="line number4 index3 alt1" style="margin: 0px 10px 10px; padding: 0px;">4</div> <div class="line number5 index4 alt2" style="margin: 0px 10px 10px; padding: 0px;">5</div> <div class="line number6 index5 alt1" style="margin: 0px 10px 10px; padding: 0px;">6</div> </td> <td class="code" style="margin: 0px; padding: 5px; border: 1px solid rgb(221, 221, 221);"> <div class="container" style="margin: auto; padding: 0px; width: 543.9px; overflow: hidden; background-color: rgb(255, 255, 255);"> <div class="line number1 index0 alt2" style="margin: 0px 10px 10px; padding: 0px;"> <code class="xml plain" style='margin: 0px; padding: 0px; font-family: Consolas, "Courier New", monospace;'>&lt;</code><code class="xml keyword" style='margin: 0px; padding: 0px; font-family: Consolas, "Courier New", monospace;'>Directory</code><span class="Apple-converted-space">&#160;</span><code class="xml plain" style='margin: 0px; padding: 0px; font-family: Consolas, "Courier New", monospace;'>“/var/www/html/rhel5”&gt;</code> </div> <div class="line number2 index1 alt1" style="margin: 0px 10px 10px; padding: 0px;"> <code class="xml spaces" style='margin: 0px; padding: 0px; font-family: Consolas, "Courier New", monospace;'>&#160;&#160;&#160;&#160;&#160;</code><code class="xml plain" style='margin: 0px; padding: 0px; font-family: Consolas, "Courier New", monospace;'>AllowOverride None</code> </div> <div class="line number3 index2 alt2" style="margin: 0px 10px 10px; padding: 0px;"> <code class="xml spaces" style='margin: 0px; padding: 0px; font-family: Consolas, "Courier New", monospace;'>&#160;&#160;&#160;&#160;&#160;</code><code class="xml plain" style='margin: 0px; padding: 0px; font-family: Consolas, "Courier New", monospace;'>Options Indexes</code> </div> <div class="line number4 index3 alt1" style="margin: 0px 10px 10px; padding: 0px;"> <code class="xml spaces" style='margin: 0px; padding: 0px; font-family: Consolas, "Courier New", monospace;'>&#160;&#160;&#160;&#160;&#160;</code><code class="xml plain" style='margin: 0px; padding: 0px; font-family: Consolas, "Courier New", monospace;'>Order allow,deny</code> </div> <div class="line number5 index4 alt2" style="margin: 0px 10px 10px; padding: 0px;"> <code class="xml spaces" style='margin: 0px; padding: 0px; font-family: Consolas, "Courier New", monospace;'>&#160;&#160;&#160;&#160;&#160;</code><code class="xml plain" style='margin: 0px; padding: 0px; font-family: Consolas, "Courier New", monospace;'>Allow from all</code> </div> <div class="line number6 index5 alt1" style="margin: 0px 10px 10px; padding: 0px;"> <code class="xml spaces" style='margin: 0px; padding: 0px; font-family: Consolas, "Courier New", monospace;'>&#160;</code><code class="xml plain" style='margin: 0px; padding: 0px; font-family: Consolas, "Courier New", monospace;'><code class="xml keyword" style='margin: 0px; padding: 0px; font-family: Consolas, "Courier New", monospace;'>Directory</code><code class="xml plain" style='margin: 0px; padding: 0px; font-family: Consolas, "Courier New", monospace;'>&gt;</code></code> </div> </div> </td> </tr></tbody></table> </div> </div> <p style="margin: 1em 0px; padding: 0px; text-indent: 2em;">设置该虚拟目录和目录权限后,可以使用客户端浏览器进行测试验证,采用别名对该目录中的文件进行访问,浏览结果如图 3 所示。</p> <h5 id="fig3" style="margin: 1em 0px; padding: 0px; font-size: 14px;">图 3. 使用虚拟目录的测试结果</h5> <p style="margin: 1em 0px; padding: 0px; text-indent: 2em;"><a title="开源 Apache 服务器安全防护技术精要及实战" class="cboxElement" style="color: rgb(28, 61, 114); text-decoration: none;" href="http://upload.chinaz.com/2013/1017/1381977512729.jpg" rel="lightbox[49548]"><img title="" class="alignnone size-full wp-image-49551" style="border: 1px solid rgb(153, 153, 153); margin-right: auto; margin-left: auto; display: block;" alt="iimage003" src="http://www.webjx.com/files/allimg/131017/2050372.jpg" border="0"></a></p> <p style="margin: 1em 0px; padding: 0px; text-indent: 2em;">&#160;</p> <h2 id="major4" style="margin: 1em 0px; padding: 0px; font-size: 18px;"><strong>限制 Apache 服务的运行环境</strong></h2> <p style="margin: 1em 0px; padding: 0px; text-indent: 2em;">Apache 服务器需要绑定到 80 端口上来监听请求,而 root 是唯一有这种权限的用户,随着攻击手段和强度的增加,这样会使服务器受到相当大的威胁,一但被利用缓冲区溢出漏洞,就可以控制整个系统。为了进一步提高系统安全性,Linux 内核引入 chroot 机制,chroot 是内核中的一个系统调用,软件可以通过调用函数库的 chroot 函数,来更改某个进程所能见到的根目录。</p> <p style="margin: 1em 0px; padding: 0px; text-indent: 2em;">chroot 机制即将某软件运行限制在指定目录中,保证该软件只能对该目录及其子目录的文件有所动作,从而保证整个服务器的安全。在这种情况下,即使出现黑客或者不法用户通过该软件破坏或被侵入系统,Linux 系统所受的损坏也仅限于该设定的根目录,而不会影响到整个系统的其他部分。</p> <p style="margin: 1em 0px; padding: 0px; text-indent: 2em;">将软件 chroot 化的一个问题是该软件运行时需要的所有程序、配置文件和库文件都必须事先安装到 chroot 目录中,通常称这个目录为 chroot“监牢”。如果在“监牢”中运行 httpd,那么用户根本看不到 Linux 文件系统中那个真正的目录,从而保证了 Linux 系统的安全。</p> <p style="margin: 1em 0px; padding: 0px; text-indent: 2em;">在使用该技术的时候,一般情况下需要事先创建目录,并将守护进程的可执行文件 httpd 复制到其中。同时,由于 httpd 需要几个库文件,所以需要把 httpd 程序依赖的几个 lib 文件同时也拷贝到同一个目录下,因此手工完成这一工作是非常麻烦的。幸运的是,用户可以通过使用开源的 jail 软件包来帮助简化 chroot“监牢”建立的过程,具体步骤如下所示:Jail 官方网站是:http://www.jmcresearch.com/projects/。</p> <p style="margin: 1em 0px; padding: 0px; text-indent: 2em;">首先将其下载,然后执行如下命令进行源代码包的编译和安装:</p> <div style="margin: 0px; padding: 0px;"> <div class="syntaxhighlighter notranslate shell ie" id="highlighter_965703" style="margin: 0px; padding: 0px;"> <table style="width: 641px; border-collapse: collapse; border-spacing: 0px; background-color: rgb(255, 255, 255);" border="0" cellspacing="0" cellpadding="0"><tbody><tr> <td class="gutter" style="margin: 0px; padding: 5px; border: 1px solid rgb(221, 221, 221);"> <div class="line number1 index0 alt2" style="margin: 0px 10px 10px; padding: 0px;">1</div> <div class="line number2 index1 alt1" style="margin: 0px 10px 10px; padding: 0px;">2</div> <div class="line number3 index2 alt2" style="margin: 0px 10px 10px; padding: 0px;">3</div> </td> <td class="code" style="margin: 0px; padding: 5px; border: 1px solid rgb(221, 221, 221);"> <div class="container" style="margin: auto; padding: 0px; width: 530.16px; overflow: hidden; background-color: rgb(255, 255, 255);"> <div class="line number1 index0 alt2" style="margin: 0px 10px 10px; padding: 0px;"><code class="shell comments" style='margin: 0px; padding: 0px; font-family: Consolas, "Courier New", monospace;'>#tar xzvf jail_1.9a.tar.gz</code></div> <div class="line number2 index1 alt1" style="margin: 0px 10px 10px; padding: 0px;"> <code class="shell spaces" style='margin: 0px; padding: 0px; font-family: Consolas, "Courier New", monospace;'>&#160;</code><code class="shell comments" style='margin: 0px; padding: 0px; font-family: Consolas, "Courier New", monospace;'>#cd jail/src</code> </div> <div class="line number3 index2 alt2" style="margin: 0px 10px 10px; padding: 0px;"> <code class="shell spaces" style='margin: 0px; padding: 0px; font-family: Consolas, "Courier New", monospace;'>&#160;</code><code class="shell comments" style='margin: 0px; padding: 0px; font-family: Consolas, "Courier New", monospace;'>#make</code> </div> </div> </td> </tr></tbody></table> </div> </div> <p style="margin: 1em 0px; padding: 0px; text-indent: 2em;">jail 软件包提供了几个 Perl 脚本作为其核心命令,包括 mkjailenv、addjailuser 和 addjailsw,他们位于解压后的目录 jail/bin 中。这几个命令的基本用途如下所示:</p> <ul style="margin: 1em 0px; padding: 0px 0px 0px 30px; list-style-type: disc;"> <li style="list-style: inherit; margin: 0px 0px 5px; padding: 0px;">mkjailenv:用于创建 chroot“监牢”目录,并且从真实文件系统中拷贝基本的软件环境。</li> <li style="list-style: inherit; margin: 0px 0px 5px; padding: 0px;">addjailsw:用于从真实文件系统中拷贝二进制可执行文件及其相关的其它文件(包括库文件、辅助性文件和设备文件)到该“监牢”中。</li> <li style="list-style: inherit; margin: 0px 0px 5px; padding: 0px;">addjailuser:创建新的 chroot“监牢”用户。</li> </ul> <p style="margin: 1em 0px; padding: 0px; text-indent: 2em;">采用 jail 创建监牢的步骤如下所示;</p> <p style="margin: 1em 0px; padding: 0px; text-indent: 2em;">(1)首先需要停止目前运行的 httpd 服务,然后建立 chroot 目录,命令如下所示。该命令将 chroot 目录建立在路径 /root/chroot/httpd 下:</p> <div style="margin: 0px; padding: 0px;"> <div class="syntaxhighlighter notranslate shell ie" id="highlighter_134380" style="margin: 0px; padding: 0px;"> <table style="width: 641px; border-collapse: collapse; border-spacing: 0px; background-color: rgb(255, 255, 255);" border="0" cellspacing="0" cellpadding="0"><tbody><tr> <td class="gutter" style="margin: 0px; padding: 5px; border: 1px solid rgb(221, 221, 221);"> <div class="line number1 index0 alt2" style="margin: 0px 10px 10px; padding: 0px;">1</div> <div class="line number2 index1 alt1" style="margin: 0px 10px 10px; padding: 0px;">2</div> <div class="line number3 index2 alt2" style="margin: 0px 10px 10px; padding: 0px;">3</div> <div class="line number4 index3 alt1" style="margin: 0px 10px 10px; padding: 0px;">4</div> <div class="line number5 index4 alt2" style="margin: 0px 10px 10px; padding: 0px;">5</div> <div class="line number6 index5 alt1" style="margin: 0px 10px 10px; padding: 0px;">6</div> <div class="line number7 index6 alt2" style="margin: 0px 10px 10px; padding: 0px;">7</div> <div class="line number8 index7 alt1" style="margin: 0px 10px 10px; padding: 0px;">8</div> <div class="line number9 index8 alt2" style="margin: 0px 10px 10px; padding: 0px;">9</div> <div class="line number10 index9 alt1" style="margin: 0px 10px 10px; padding: 0px;">10</div> <div class="line number11 index10 alt2" style="margin: 0px 10px 10px; padding: 0px;">11</div> <div class="line number12 index11 alt1" style="margin: 0px 10px 10px; padding: 0px;">12</div> <div class="line number13 index12 alt2" style="margin: 0px 10px 10px; padding: 0px;">13</div> <div class="line number14 index13 alt1" style="margin: 0px 10px 10px; padding: 0px;">14</div> <div class="line number15 index14 alt2" style="margin: 0px 10px 10px; padding: 0px;">15</div> </td> <td class="code" style="margin: 0px; padding: 5px; border: 1px solid rgb(221, 221, 221);"> <div class="container" style="margin: auto; padding: 0px; width: 558.58px; overflow: hidden; background-color: rgb(255, 255, 255);"> <div class="line number1 index0 alt2" style="margin: 0px 10px 10px; padding: 0px;"><code class="shell comments" style='margin: 0px; padding: 0px; font-family: Consolas, "Courier New", monospace;'># service httpd stop</code></div> <div class="line number2 index1 alt1" style="margin: 0px 10px 10px; padding: 0px;"> <code class="shell spaces" style='margin: 0px; padding: 0px; font-family: Consolas, "Courier New", monospace;'>&#160;</code><code class="shell comments" style='margin: 0px; padding: 0px; font-family: Consolas, "Courier New", monospace;'># mkjailenv /root/chroot/httpd</code> </div> <div class="line number3 index2 alt2" style="margin: 0px 10px 10px; padding: 0px;"> <code class="shell spaces" style='margin: 0px; padding: 0px; font-family: Consolas, "Courier New", monospace;'>&#160;</code><code class="shell plain" style='margin: 0px; padding: 0px; font-family: Consolas, "Courier New", monospace;'>kjailenv</code> </div> <div class="line number4 index3 alt1" style="margin: 0px 10px 10px; padding: 0px;"> <code class="shell spaces" style='margin: 0px; padding: 0px; font-family: Consolas, "Courier New", monospace;'>&#160;</code><code class="shell plain" style='margin: 0px; padding: 0px; font-family: Consolas, "Courier New", monospace;'>A component of Jail (version 1.9<span class="Apple-converted-space">&#160;</span></code><code class="shell keyword" style='margin: 0px; padding: 0px; font-family: Consolas, "Courier New", monospace;'>for</code><span class="Apple-converted-space">&#160;</span><code class="shell plain" style='margin: 0px; padding: 0px; font-family: Consolas, "Courier New", monospace;'>linux)</code> </div> <div class="line number5 index4 alt2" style="margin: 0px 10px 10px; padding: 0px;"> <code class="shell spaces" style='margin: 0px; padding: 0px; font-family: Consolas, "Courier New", monospace;'>&#160;</code>&#160;</div> <div class="line number6 index5 alt1" style="margin: 0px 10px 10px; padding: 0px;"> <code class="shell plain" style='margin: 0px; padding: 0px; font-family: Consolas, "Courier New", monospace;'>http:</code><code class="shell plain" style='margin: 0px; padding: 0px; font-family: Consolas, "Courier New", monospace;'>//www</code><code class="shell plain" style='margin: 0px; padding: 0px; font-family: Consolas, "Courier New", monospace;'>.gsyc.inf.uc3m.es/~assman</code><code class="shell plain" style='margin: 0px; padding: 0px; font-family: Consolas, "Courier New", monospace;'>/jail/</code> </div> <div class="line number7 index6 alt2" style="margin: 0px 10px 10px; padding: 0px;"> <code class="shell spaces" style='margin: 0px; padding: 0px; font-family: Consolas, "Courier New", monospace;'>&#160;</code>&#160;</div> <div class="line number8 index7 alt1" style="margin: 0px 10px 10px; padding: 0px;"> <code class="shell spaces" style='margin: 0px; padding: 0px; font-family: Consolas, "Courier New", monospace;'>&#160;</code><code class="shell plain" style='margin: 0px; padding: 0px; font-family: Consolas, "Courier New", monospace;'>Juan M. Casillas &lt;assman@gsyc.inf.uc3m.es&gt;&#160;</code> </div> <div class="line number9 index8 alt2" style="margin: 0px 10px 10px; padding: 0px;"> <code class="shell spaces" style='margin: 0px; padding: 0px; font-family: Consolas, "Courier New", monospace;'>&#160;</code>&#160;</div> <div class="line number10 index9 alt1" style="margin: 0px 10px 10px; padding: 0px;"> <code class="shell spaces" style='margin: 0px; padding: 0px; font-family: Consolas, "Courier New", monospace;'>&#160;</code><code class="shell plain" style='margin: 0px; padding: 0px; font-family: Consolas, "Courier New", monospace;'>Making chrooted environment into<span class="Apple-converted-space">&#160;</span></code><code class="shell plain" style='margin: 0px; padding: 0px; font-family: Consolas, "Courier New", monospace;'>/root/chroot/httpd</code> </div> <div class="line number11 index10 alt2" style="margin: 0px 10px 10px; padding: 0px;"> <code class="shell spaces" style='margin: 0px; padding: 0px; font-family: Consolas, "Courier New", monospace;'>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;</code><code class="shell plain" style='margin: 0px; padding: 0px; font-family: Consolas, "Courier New", monospace;'>Doing preinstall()</code> </div> <div class="line number12 index11 alt1" style="margin: 0px 10px 10px; padding: 0px;"> <code class="shell spaces" style='margin: 0px; padding: 0px; font-family: Consolas, "Courier New", monospace;'>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;</code><code class="shell plain" style='margin: 0px; padding: 0px; font-family: Consolas, "Courier New", monospace;'>Doing special_devices()</code> </div> <div class="line number13 index12 alt2" style="margin: 0px 10px 10px; padding: 0px;"> <code class="shell spaces" style='margin: 0px; padding: 0px; font-family: Consolas, "Courier New", monospace;'>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;</code><code class="shell plain" style='margin: 0px; padding: 0px; font-family: Consolas, "Courier New", monospace;'>Doing gen_template_password()</code> </div> <div class="line number14 index13 alt1" style="margin: 0px 10px 10px; padding: 0px;"> <code class="shell spaces" style='margin: 0px; padding: 0px; font-family: Consolas, "Courier New", monospace;'>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;</code><code class="shell plain" style='margin: 0px; padding: 0px; font-family: Consolas, "Courier New", monospace;'>Doing postinstall()</code> </div> <div class="line number15 index14 alt2" style="margin: 0px 10px 10px; padding: 0px;"> <code class="shell spaces" style='margin: 0px; padding: 0px; font-family: Consolas, "Courier New", monospace;'>&#160;</code><code class="shell plain" style='margin: 0px; padding: 0px; font-family: Consolas, "Courier New", monospace;'>Done.</code> </div> </div> </td> </tr></tbody></table> </div> </div> <p style="margin: 1em 0px; padding: 0px; text-indent: 2em;">(2)为“监牢”添加 httpd 程序,命令如下:</p> <div style="margin: 0px; padding: 0px;"> <div class="syntaxhighlighter notranslate shell ie" id="highlighter_106027" style="margin: 0px; padding: 0px;"> <table style="width: 641px; border-collapse: collapse; border-spacing: 0px; background-color: rgb(255, 255, 255);" border="0" cellspacing="0" cellpadding="0"><tbody><tr> <td class="gutter" style="margin: 0px; padding: 5px; border: 1px solid rgb(221, 221, 221);"> <div class="line number1 index0 alt2" style="margin: 0px 10px 10px; padding: 0px;">1</div> <div class="line number2 index1 alt1" style="margin: 0px 10px 10px; padding: 0px;">2</div> <div class="line number3 index2 alt2" style="margin: 0px 10px 10px; padding: 0px;">3</div> <div class="line number4 index3 alt1" style="margin: 0px 10px 10px; padding: 0px;">4</div> <div class="line number5 index4 alt2" style="margin: 0px 10px 10px; padding: 0px;">5</div> <div class="line number6 index5 alt1" style="margin: 0px 10px 10px; padding: 0px;">6</div> <div class="line number7 index6 alt2" style="margin: 0px 10px 10px; padding: 0px;">7</div> <div class="line number8 index7 alt1" style="margin: 0px 10px 10px; padding: 0px;">8</div> <div class="line number9 index8 alt2" style="margin: 0px 10px 10px; padding: 0px;">9</div> <div class="line number10 index9 alt1" style="margin: 0px 10px 10px; padding: 0px;">10</div> <div class="line number11 index10 alt2" style="margin: 0px 10px 10px; padding: 0px;">11</div> <div class="line number12 index11 alt1" style="margin: 0px 10px 10px; padding: 0px;">12</div> <div class="line number13 index12 alt2" style="margin: 0px 10px 10px; padding: 0px;">13</div> </td> <td class="code" style="margin: 0px; padding: 5px; border: 1px solid rgb(221, 221, 221);"> <div class="container" style="margin: auto; padding: 0px; width: 565.45px; overflow: hidden; background-color: rgb(255, 255, 255);"> <div class="line number1 index0 alt2" style="margin: 0px 10px 10px; padding: 0px;"><code class="shell comments" style='margin: 0px; padding: 0px; font-family: Consolas, "Courier New", monospace;'># ./addjailsw&#160; /root/chroot/httpd/ -P /usr/sbin/httpd&#160;</code></div> <div class="line number2 index1 alt1" style="margin: 0px 10px 10px; padding: 0px;"> <code class="shell spaces" style='margin: 0px; padding: 0px; font-family: Consolas, "Courier New", monospace;'>&#160;</code>&#160;</div> <div class="line number3 index2 alt2" style="margin: 0px 10px 10px; padding: 0px;"> <code class="shell spaces" style='margin: 0px; padding: 0px; font-family: Consolas, "Courier New", monospace;'>&#160;</code><code class="shell plain" style='margin: 0px; padding: 0px; font-family: Consolas, "Courier New", monospace;'>addjailsw</code> </div> <div class="line number4 index3 alt1" style="margin: 0px 10px 10px; padding: 0px;"> <code class="shell spaces" style='margin: 0px; padding: 0px; font-family: Consolas, "Courier New", monospace;'>&#160;</code><code class="shell plain" style='margin: 0px; padding: 0px; font-family: Consolas, "Courier New", monospace;'>A component of Jail (version 1.9<span class="Apple-converted-space">&#160;</span></code><code class="shell keyword" style='margin: 0px; padding: 0px; font-family: Consolas, "Courier New", monospace;'>for</code><span class="Apple-converted-space">&#160;</span><code class="shell plain" style='margin: 0px; padding: 0px; font-family: Consolas, "Courier New", monospace;'>linux)</code> </div> <div class="line number5 index4 alt2" style="margin: 0px 10px 10px; padding: 0px;"> <code class="shell spaces" style='margin: 0px; padding: 0px; font-family: Consolas, "Courier New", monospace;'>&#160;</code>&#160;</div> <div class="line number6 index5 alt1" style="margin: 0px 10px 10px; padding: 0px;"> <code class="shell plain" style='margin: 0px; padding: 0px; font-family: Consolas, "Courier New", monospace;'>http:</code><code class="shell plain" style='margin: 0px; padding: 0px; font-family: Consolas, "Courier New", monospace;'>//www</code><code class="shell plain" style='margin: 0px; padding: 0px; font-family: Consolas, "Courier New", monospace;'>.gsyc.inf.uc3m.es/~assman</code><code class="shell plain" style='margin: 0px; padding: 0px; font-family: Consolas, "Courier New", monospace;'>/jail/</code> </div> <div class="line number7 index6 alt2" style="margin: 0px 10px 10px; padding: 0px;"> <code class="shell spaces" style='margin: 0px; padding: 0px; font-family: Consolas, "Courier New", monospace;'>&#160;</code>&#160;</div> <div class="line number8 index7 alt1" style="margin: 0px 10px 10px; padding: 0px;"> <code class="shell spaces" style='margin: 0px; padding: 0px; font-family: Consolas, "Courier New", monospace;'>&#160;</code><code class="shell plain" style='margin: 0px; padding: 0px; font-family: Consolas, "Courier New", monospace;'>Juan M. Casillas &lt;assman@gsyc.inf.uc3m.es&gt;&#160;</code> </div> <div class="line number9 index8 alt2" style="margin: 0px 10px 10px; padding: 0px;"> <code class="shell spaces" style='margin: 0px; padding: 0px; font-family: Consolas, "Courier New", monospace;'>&#160;</code>&#160;</div> <div class="line number10 index9 alt1" style="margin: 0px 10px 10px; padding: 0px;"> <code class="shell spaces" style='margin: 0px; padding: 0px; font-family: Consolas, "Courier New", monospace;'>&#160;</code><code class="shell plain" style='margin: 0px; padding: 0px; font-family: Consolas, "Courier New", monospace;'>Guessing<span class="Apple-converted-space">&#160;</span></code><code class="shell plain" style='margin: 0px; padding: 0px; font-family: Consolas, "Courier New", monospace;'>/usr/sbin/httpd</code><span class="Apple-converted-space">&#160;</span><code class="shell plain" style='margin: 0px; padding: 0px; font-family: Consolas, "Courier New", monospace;'>args(0)</code> </div> <div class="line number11 index10 alt2" style="margin: 0px 10px 10px; padding: 0px;"> <code class="shell spaces" style='margin: 0px; padding: 0px; font-family: Consolas, "Courier New", monospace;'>&#160;</code><code class="shell plain" style='margin: 0px; padding: 0px; font-family: Consolas, "Courier New", monospace;'>Warning: can't create<span class="Apple-converted-space">&#160;</span></code><code class="shell plain" style='margin: 0px; padding: 0px; font-family: Consolas, "Courier New", monospace;'>/proc/mounts</code><span class="Apple-converted-space">&#160;</span><code class="shell plain" style='margin: 0px; padding: 0px; font-family: Consolas, "Courier New", monospace;'>from the<span class="Apple-converted-space">&#160;</span></code><code class="shell plain" style='margin: 0px; padding: 0px; font-family: Consolas, "Courier New", monospace;'>/proc</code><span class="Apple-converted-space">&#160;</span><code class="shell plain" style='margin: 0px; padding: 0px; font-family: Consolas, "Courier New", monospace;'>filesystem&#160;</code> </div> <div class="line number12 index11 alt1" style="margin: 0px 10px 10px; padding: 0px;"> <code class="shell spaces" style='margin: 0px; padding: 0px; font-family: Consolas, "Courier New", monospace;'>&#160;</code>&#160;</div> <div class="line number13 index12 alt2" style="margin: 0px 10px 10px; padding: 0px;"> <code class="shell spaces" style='margin: 0px; padding: 0px; font-family: Consolas, "Courier New", monospace;'>&#160;</code><code class="shell plain" style='margin: 0px; padding: 0px; font-family: Consolas, "Courier New", monospace;'>Done.</code> </div> </div> </td> </tr></tbody></table> </div> </div> <p style="margin: 1em 0px; padding: 0px; text-indent: 2em;">在上述过程中,用户不需要在意那些警告信息,因为 jail 会调用 ldd 检查 httpd 用到的库文件。而几乎所有基于共享库的二进制可执行文件都需要上述的几个库文件。</p> <p style="margin: 1em 0px; padding: 0px; text-indent: 2em;">(3)然后,将 httpd 的相关文件拷贝到“监牢”的相关目录中,命令如下所示:</p> <div style="margin: 0px; padding: 0px;"> <div class="syntaxhighlighter notranslate shell ie" id="highlighter_574679" style="margin: 0px; padding: 0px;"> <table style="width: 641px; border-collapse: collapse; border-spacing: 0px; background-color: rgb(255, 255, 255);" border="0" cellspacing="0" cellpadding="0"><tbody><tr> <td class="gutter" style="margin: 0px; padding: 5px; border: 1px solid rgb(221, 221, 221);"> <div class="line number1 index0 alt2" style="margin: 0px 10px 10px; padding: 0px;">1</div> <div class="line number2 index1 alt1" style="margin: 0px 10px 10px; padding: 0px;">2</div> <div class="line number3 index2 alt2" style="margin: 0px 10px 10px; padding: 0px;">3</div> </td> <td class="code" style="margin: 0px; padding: 5px; border: 1px solid rgb(221, 221, 221);"> <div class="container" style="margin: auto; padding: 0px; width: 559.56px; overflow: hidden; background-color: rgb(255, 255, 255);"> <div class="line number1 index0 alt2" style="margin: 0px 10px 10px; padding: 0px;"><code class="shell comments" style='margin: 0px; padding: 0px; font-family: Consolas, "Courier New", monospace;'># mkdir -p /root/chroot/httpd/etc</code></div> <div class="line number2 index1 alt1" style="margin: 0px 10px 10px; padding: 0px;"> <code class="shell spaces" style='margin: 0px; padding: 0px; font-family: Consolas, "Courier New", monospace;'>&#160;</code><code class="shell comments" style='margin: 0px; padding: 0px; font-family: Consolas, "Courier New", monospace;'># cp &#8211; a /etc/httpd /root/chroot/httpd/etc/</code> </div> <div class="line number3 index2 alt2" style="margin: 0px 10px 10px; padding: 0px;"><code class="shell plain" style='margin: 0px; padding: 0px; font-family: Consolas, "Courier New", monospace;'>。。。。。。</code></div> </div> </td> </tr></tbody></table> </div> </div> <p style="margin: 1em 0px; padding: 0px; text-indent: 2em;">添加后的目录结构如下所示:</p> <div style="margin: 0px; padding: 0px;"> <div class="syntaxhighlighter notranslate shell ie" id="highlighter_915988" style="margin: 0px; padding: 0px;"> <table style="width: 641px; border-collapse: collapse; border-spacing: 0px; background-color: rgb(255, 255, 255);" border="0" cellspacing="0" cellpadding="0"><tbody><tr> <td class="gutter" style="margin: 0px; padding: 5px; border: 1px solid rgb(221, 221, 221);"> <div class="line number1 index0 alt2" style="margin: 0px 10px 10px; padding: 0px;">1</div> <div class="line number2 index1 alt1" style="margin: 0px 10px 10px; padding: 0px;">2</div> <div class="line number3 index2 alt2" style="margin: 0px 10px 10px; padding: 0px;">3</div> <div class="line number4 index3 alt1" style="margin: 0px 10px 10px; padding: 0px;">4</div> <div class="line number5 index4 alt2" style="margin: 0px 10px 10px; padding: 0px;">5</div> <div class="line number6 index5 alt1" style="margin: 0px 10px 10px; padding: 0px;">6</div> <div class="line number7 index6 alt2" style="margin: 0px 10px 10px; padding: 0px;">7</div> <div class="line number8 index7 alt1" style="margin: 0px 10px 10px; padding: 0px;">8</div> <div class="line number9 index8 alt2" style="margin: 0px 10px 10px; padding: 0px;">9</div> </td> <td class="code" style="margin: 0px; padding: 5px; border: 1px solid rgb(221, 221, 221);"> <div class="container" style="margin: auto; padding: 0px; width: 563.5px; overflow: hidden; background-color: rgb(255, 255, 255);"> <div class="line number1 index0 alt2" style="margin: 0px 10px 10px; padding: 0px;"><code class="shell comments" style='margin: 0px; padding: 0px; font-family: Consolas, "Courier New", monospace;'># ll</code></div> <div class="line number2 index1 alt1" style="margin: 0px 10px 10px; padding: 0px;"><code class="shell plain" style='margin: 0px; padding: 0px; font-family: Consolas, "Courier New", monospace;'>总计 56</code></div> <div class="line number3 index2 alt2" style="margin: 0px 10px 10px; padding: 0px;"> <code class="shell spaces" style='margin: 0px; padding: 0px; font-family: Consolas, "Courier New", monospace;'>&#160;</code><code class="shell plain" style='margin: 0px; padding: 0px; font-family: Consolas, "Courier New", monospace;'>drwxr-xr-x 2 root root 4096 03-23 13:44 dev</code> </div> <div class="line number4 index3 alt1" style="margin: 0px 10px 10px; padding: 0px;"> <code class="shell spaces" style='margin: 0px; padding: 0px; font-family: Consolas, "Courier New", monospace;'>&#160;</code><code class="shell plain" style='margin: 0px; padding: 0px; font-family: Consolas, "Courier New", monospace;'>drwxr-xr-x 3 root root 4096 03-23 13:46 etc</code> </div> <div class="line number5 index4 alt2" style="margin

    Read more +
  • 17

    2018-05
    phpwind推进中小网站生态链 启动全国巡回会议

    <p> </p> <table style="BORDER-RIGHT: #cccccc 1px dotted; TABLE-LAYOUT: fixed; BORDER-TOP: #cccccc 1px dotted; BORDER-LEFT: #cccccc 1px dotted; BORDER-BOTTOM: #cccccc 1px dotted" cellspacing="0" cellpadding="6" width="95%" align="center" border="0"><tbody><tr> <td style="WORD-WRAP: break-word" bgcolor="#fdfddf"> <font color="#ff0000">WebjxCom提示:</font><font color="#000000">9月8日,阿里巴巴旗下通用型建站软件phpwind在北京盘古大观七星酒店举行搜索新商机,迎接新朋友全国巡回地面交流会起航之旅发布会。Phpwind、淘宝联盟、新浪微博、淘宝网10大品牌商城、20多家地方与行业网站出席会议。Phpwind CEO王学集表示,phpwind将和新浪微博、淘</font> </td> </tr></tbody></table> <p>  9月8日,阿里巴巴旗下通用型建站软件phpwind在北京盘古大观七星酒店举行“搜索新商机,迎接新朋友”全国巡回地面交流会起航之旅发布会。Phpwind、淘宝联盟、新浪微博、淘宝网10大品牌商城、20多家地方与行业网站出席会议。Phpwind CEO王学集表示,phpwind将和新浪微博、淘宝联盟合作,为中小网站提供内容运营、电子商务等多方位资源,phpwind将举办40场全国巡回的地面交流会,把这些资源推荐给更多的中小网站,帮助中小网站建立良好的生态环境。</p> <p>  phpwind多方跨平台合作 丰富中小网站运营资源</p> <p>  Phpwind在会议介绍了phpwind 的产品开发机会,除了基础产品,还将开发更多基于云平台的应用。phpwind CEO王学集表示,phpwind将尽力建立一个产品和技术平台,除了建站产品之外,能够支撑更多的资源,为phpwind中小网站提供配套的内容运营、商业运营资源。</p> <p>  在发布会上,十大淘宝品牌商家将十锭金元宝送于十大地方网站站长,寓意淘宝百万商家与数百万站长共享电子商务大金矿,淘宝联盟总监闻仲表示,淘宝联盟希望在2010年为站长提供10亿分成。Phpwind和淘宝联盟推进淘宝品牌商家和各网站的对接,将更好的满足淘宝品牌商家拓展营销渠道的需求,也为地方与行业网站带来更好的收入来源。</p> <p>  新浪微博总监芦义介绍,新浪微博已经和phpwind产品的微博组件全面打通,可以与所有使用phpwind微博组件的中小网站共享内容,在将来,将会帮众多中小网站建立一个广阔的内容传播渠道。</p> <p>  DCCI互联网数据中心总经理胡延平在会上表示,以开放平台为基础的开放协作潮流成为互联网发展的一个脉搏,phpwind、淘宝联盟、新浪微博分别作为产品和技术平台、商业资源平台、内容共享和交流平台,相互交织,为中国的中小网站提供了多方位的资源支持。共同打造出一个良性社区生态圈。</p> <p>  启动40场地面交流会 全面覆盖地方级和行业网站</p> <p>  胡延平表示,互联网第三次创业浪潮即将到来,新的互联网浪潮将会形成以开放平台与中小型网站合作的生态环境,每个中小型网站,都需要考虑如何定位自己在生态环境中的位置,哪些平台型的产品可以帮助让网站深度兑现自身资源,这非常考验中小型网站对于互联网生态的理解。</p> <p>  Phpwind CEO王学集介绍,为了全面与各类地方和行业网站深入交流,帮助站长对互联网新的发展浪潮生有更多完整的认识,更便利的获取多方资源,phpwind联合淘宝联盟、新浪微博等合作伙伴,Chinaz、admin5等最具影响力的站长专业媒体,一起进行主题为“搜索新商机,迎接新朋友”全国巡回的地面交流会,覆盖全国24个省份共40个城市。</p> <p>  王学集还透露,phpwind将在12月份在杭州举行一场大规模的地方和行业网站发展大会。</p>

    Read more +
  • 17

    2018-05
    社区电子商务不要拘泥于电子商务的形态

    <p> </p> <table style="BORDER-RIGHT: #cccccc 1px dotted; TABLE-LAYOUT: fixed; BORDER-TOP: #cccccc 1px dotted; BORDER-LEFT: #cccccc 1px dotted; BORDER-BOTTOM: #cccccc 1px dotted" cellspacing="0" cellpadding="6" width="95%" align="center" border="0"><tbody><tr> <td style="WORD-WRAP: break-word" bgcolor="#fdfddf"> <font color="#ff0000">WebjxCom提示:</font><font color="#000000">社区电子商务一直被人曲解,人们一会认为社区电子商务就是淘宝式的电子商务平台,一会认为groupon式的团购就是社区电子商务。那么,社区电子商务的产品形态或者实现方式究竟是怎样的呢?甚至我们需要思考,社区电子商务究竟是什么样的东西? 笔者第一次认识到社区电子商</font> </td> </tr></tbody></table> <p>  社区电子商务一直被人曲解,人们一会认为社区电子商务就是淘宝式的电子商务平台,一会认为groupon式的团购就是社区电子商务。那么,社区电子商务的产品形态或者实现方式究竟是怎样的呢?甚至我们需要思考,社区电子商务究竟是什么样的东西?</p> <p>  笔者第一次认识到社区电子商务是通过一个案例:</p> <p>  2005年,南京篱笆网上有一个商家&#8212;&#8212;大家风范实木工艺门,老板的网名叫做曾经沧海。他在篱笆论坛从不发广告,可是每个月的团购金额有30万,好几位团头帮他组织。他是怎么做的?</p> <p>  原来,这位网名叫做曾经沧海的李老板花了大约半年时间,在篱笆论坛非常耐心的为网友答疑解惑,讲解木门的知识。树立了木门专家的良好印象,网友遇到木门问题,第一个就是想到他。虽然他很低调,但是他是大家风范老板的消息还是让大家知道了,于是生意格外得好。不过,后来李老板没有处理好一次与网友的订单冲突,从此一蹶不振。</p> <p>  仅靠论坛发帖就能获得订单?这对于许多人尤其是商家来说一定不可思议。然而在中国,许许多多的中小企业就是利用区域型的网站的论坛生存的。他们的成长方式一般是:学会发小广告&#8212;&#8212;》学会互动&#8212;&#8212;》懂得口碑营销。一些深谙此道的淘宝店,也非常懂得社区意见领袖的价值。例如,在瑞丽、YOKA时尚、ONLYLADY等女性网站的社区里,意见领袖每一次败物搭配秀都将引来相关网店的大量订单。</p> <p>  由互动、分享所带来的商业价值,衍生出社区电子商务的一种模式:团购。相对于目前风靡的groupon式的团购,这种团购被成为团购1.0。篱笆网早期、齐家网(上海团购网)、合肥团购网、55BBS、重庆购物狂等网站上最流行的社区电子商务形态就是团购。这种团购业态还产生出一种职业:团长或者团头(一种戏称),他们的任务是在论坛召集团友,促成买卖双方的交易,并且从中提取一定的佣金。</p> <p>  groupon模式来得太快,也太迅猛。简单团购功能的网站如雨后春笋般涌现。在这场热潮中,我们必须反思,团购2.0与1.0相比,到底是进步还是后退?在“XX团购网获得数千万美元风投”这样的消息频繁轰炸下,在疯狂与泡沫之中,我们发现,团购2.0缺乏与社区的联系,缺少互动与粘度。在各大门户相继推出团购之际,在社区软件开发商德天(phpwind)与康盛创想(discuz)分别推出与社区互动的团购功能之际,团购2.0该升级还是固守“一天一个团购”这种模式呢?</p> <p>  除了团购这一个脉络,社区电子商务的另一个重要分支就是平台模式,在人们不知道如何解决社区电子商务问题的时候,开发出的产品就像淘宝的孪生兄弟。篱笆网非常成功地转型,建立了篱笆商城,并且实现部分在线交易。但是,当许多人看到业界称作成功案例的365家居宝、合论婚庆宝、小鱼婚嫁等社区电子商务平台的时候,淘宝给他们留下的极为固化的概念促使他们发问:这种东西是电子商务吗?在线展示却不交易,这是电子商务吗?</p> <p>  必须反问,谁说电子商务就必须在线交易?谁说电子商务必须在线支付?概念重要还是行业需求重要?我们必须猛醒:我们的用户怎么在用我们的网站?我们的客户如何利用我们的网站达成交易?他们交易的细节是什么?&#8212;&#8212;这,远比学院的概念重要!在用户需求面前,学院的概念可以去见鬼了!</p> <p>  社区电子商务的形态还不止于此!淘宝开发的各种淘客形式,早期的淘客、秒杀,近来的陶满意;许多社区游戏插件的嵌入式广告;古老的分类信息&#8212;&#8212;这些,都是社区电子商务的生存形态。必须认识到,社区电子商务具有多样性的特征!</p> <p>  就各种不同网站而言,在引入电子商务的时候,一定不要拘泥于某种定式思维,片面地认为淘宝才是电子商务。在不同阶段,可以适时尝试不同类型的社区电子商务方式。例如:小站做团购,大站做平台。因为团购可以带来人气,而平台则需要巨大人气支撑和强大的运营能力。</p> <p>  社区电子商务,在整个行业对web2.0的质疑声中茁壮成长,千变万化,用不同形式展现。我们必须深刻认识到,在互联网的世界中,社区离不开电子商务,而电子商务也离不开社区。(宁哲网络周宁)</p>

    Read more +
  • 17

    2018-05
    PHP如今是个什么样呢?PHP是个集中营

    <p> </p> <table style="BORDER-RIGHT: #cccccc 1px dotted; TABLE-LAYOUT: fixed; BORDER-TOP: #cccccc 1px dotted; BORDER-LEFT: #cccccc 1px dotted; BORDER-BOTTOM: #cccccc 1px dotted" cellspacing="0" cellpadding="6" width="95%" align="center" border="0"><tbody><tr> <td style="WORD-WRAP: break-word" bgcolor="#fdfddf"> <font color="#ff0000">WebjxCom提示:</font><font color="#000000">为什么说PHP是个集中营.</font> </td> </tr></tbody></table> <p>本文是从 <a href="http://codefury.net/2011/04/why-php-was-a-ghetto/" target="_blank"><font color="#0000ff">Why PHP Was a Ghetto</font></a> 这篇文章翻译而来。</p> <p>有一天我跟在<a href="http://dumbonyc.com/" target="_blank"><font color="#0000ff">DUMBO</font></a>的一个非常棒的创业公司的老板聊天,谈到为什么非PHP界的开发人员普遍轻视PHP和PHP相关社区。他提出了一个观点让我印象很深,很大程度上是因为以前从来没有听到过这样的说法。</p> <p>如果你不知道大多数的程序员都会对PHP发什么样的牢骚,那么,这些牢骚差不多会像这样:</p> <p><strong>语法丑陋</strong></p> <p><strong>缺乏其它语言都有的一些必要的特征(在5.3版本之前,没有命名空间,闭包)</strong></p> <p><strong>不一致的函数命名、使用惯例,以及其它一些怪异的东西</strong></p> <p><strong>过程和面向对象的杂混</strong></p> <p><strong>基本上80-90%的PHP项目都烂如一堆狗屎</strong></p> <p>但他所说的PHP的问题却是另外一个问题。他并没有说这种语言有问题&#8212;&#8212;他认为这种语言被一种常见的文化现象包围着,是一种通常由语言的创造者造就的文化传统,现在看来这对一些糟糕的编程实践方法起到了鼓励作用。也就是它使PHP代码变的劣质和不可维护。</p> <p>这种一个语言或框架上体现出创始人的哲学思想并被相关社区推崇的现象是的确存在的。他拿出来Ruby和其创始人<a href="http://en.wikipedia.org/wiki/Yukihiro_Matsumoto" target="_blank"><font color="#0000ff">Matz</font></a>作为例子。Matz想要的是一种易读易写、能提高程序员工作效率的语言。没看见Ruby开发人员们言之必称快速开发以及这种语言的优雅?</p> <p>接着就是<a href="http://en.wikipedia.org/wiki/David_Heinemeier_Hansson" target="_blank"><font color="#0000ff">DHH </font></a>和他的Rails框架。还有<a href="http://www.python.org/~guido/" target="_blank"><font color="#0000ff">Guido</font></a>和他的Python语言。于是我在想:<a href="http://en.wikipedia.org/wiki/Rasmus_Lerdorf" target="_blank"><font color="#0000ff">Rasmus</font></a>对于PHP呢?</p> <p>Rasmus Lerdorf给人的印象非常的有趣。他创建了最初版的PHP语言,而且一直在改进这种语言,他在PHP社区里被当作神一样崇拜,他在PHP的任何方面都享有最大的权威。他被众多的会议邀请去做演讲,同时被大网络公司(yahoo.com)所雇用,他获得了所有人的尊敬&#8212;&#8212;尽管有这样一种事实:他成了大多数的非PHP程序员所鄙视的PHP上的众多问题的形象代表。</p> <p>Rasmus倡导避免使用框架,而把PHP更多的当作一种模板语言。对他来说,这种做法能产生直接的运行效率和可扩展性(程序负载可知)。而对于其他的所有人来说,这种做法导致了大量的乱炖似的过程式代码,大量的无法维护的项目。自从1995年PHP诞生至今大概10年左右的时间里,所有的PHP项目都是按照这种指导写成的。</p> <p>与此同时另外一个问题突然的出现了:在PHP5.0之前,PHP的初期,PHP获得了大量的新手的追随。这种语言的入门门槛出奇的低,任何人都可以下载自解压的×AMP Windows程序安装包、在2两分钟内用上这种语言。除此之外,那时在Web开发方式上对MVC模式的共识并没有真正的出现。这样一来你可以想象,一群新手和一个缺乏好的开发实践方法的语言组合到一起能创造出什么?一堆无法维护的垃圾。而且整个大环境都是这样。</p> <p>不要误解我的话&#8212;&#8212;优秀的PHP开发者还是不少的,即使是当时。但是,就像我说的,粗制滥造的菜鸟作品到处都是。当牛仔式无羁的PHP程序员在没有指导原则的情况下聚集到一起开发程序,于是像PHPbb、 PHPNuke以及很多的粗糙的.php3程序包就出现了。但是你能单纯的责怪PHP开发人员吗?不能!其它的Web语言巨人,ASP和Perl,同样恶名远扬,同样宣传着一种乱炖式的开发方式。</p> <p>所以这就是为什么PHP会得到这样的骂名。是因为它的历史流传。大多数已经转向Python,Ruby和Java的PHP开发人员并没有在MVC概念兴起时回头去重新思考这种语言。此外,更有一些像”Ruby公子“Zed Shaw抱怨一些程序员的思想”受PHP毒害“这样的露骨的讽刺,像这样的言论在<a href="http://www.rubyinside.com/holiday-fun-how-programming-language-fanboys-see-each-others-languages-2911.html" target="_blank"><font color="#0000ff">RubyInside</font></a>上很盛行。</p> <p><strong>PHP是个集中营</strong></p> <p>但像Zend和CodeIgniter这样的框架的出现把这种语言推向了正确的开发方向上。事实上,它把PHP推向了与Rasmus所希望看到的相反的方向上了。查看一下Zend和CodeIgniter框架,你会发现它们是为数不多的文档写的很好,代码写的很好的程序。</p> <p>大多数学习了Ruby的开发人员同时都要学习Rails和MVC知识;PHP在此之前已经被使用了整整10年。对于那些新手来说,可恶的Ruby没有给他们这段时间让他们自由发挥。Rails有现成的标准指导,它的入门门槛相对高很多,通常会把一些缺少经验的开发人员挡在门外。</p> <p>事实上,PHP应用程序是可以向其它种语言那样写的很好,而且还会具有一定的运行速度上的优势。PHP世界里的MVC风格的开发方法兴起只是在近几年才出现的现象。不得不承认,我们应该感谢Rails带来的这种变化。</p> <p><strong>那么,PHP如今是个什么样呢?</strong></p> <p>各种标准(非统一,但大多数项目使用MVC,很少有垃圾般的过程式程序)</p> <p><strong>很低的入门门槛</strong></p> <p>速度和可扩展性(在各种脚本语言里PHP应该是最好的)</p> <p><strong>有一个好的单元测试框架</strong></p> <p>有最好的各国语言翻译的文档</p> <p>除此之外,互联网上大多数有影响的网站都使用PHP作为它们后台的语言或工具,诸如Facebook,Digg,维基百科,Wordpress,Drupal等等。我相信,对PHP有一个深入的掌握会使一个程序员打开更多的未知领域的大门。</p> <p>如果你不赞同上面所说的,请留下评论,或email给我&#8212;&#8212;我想听听你为什么不这么认为。</p> <p>事实上,我并不是一个PHP迷,我对语言没有感觉。我使用PHP大多是因为&#8212;&#8212;你猜到了&#8212;&#8212;有人愿意付钱给我。所以一切归咎于此:</p> <p>如果你希望在软件设计上做出明智的决定,PHP是你开发Web应用程序的最佳选择。</p> <p>顺便说一下,如果你确信要使用PHP来开发下一个Web应用,请试一试<a href="http://codeigniter.com/" target="_blank"><font color="#0000ff">CodeIgniter</font></a>。它是一个轻量级的,普通的,超级快的PHP框架。对于CodeIgniter,我是个粉丝。</p>

    Read more +
  • 17

    2018-05
    Win7系统安装PHPnow的解决方法

    <p> </p> <table style="BORDER-RIGHT: #cccccc 1px dotted; TABLE-LAYOUT: fixed; BORDER-TOP: #cccccc 1px dotted; BORDER-LEFT: #cccccc 1px dotted; BORDER-BOTTOM: #cccccc 1px dotted" cellspacing="0" cellpadding="6" width="95%" align="center" border="0"><tbody><tr> <td style="WORD-WRAP: break-word" bgcolor="#fdfddf"> <font color="#ff0000">WebjxCom提示:</font><font color="#000000">Win7系统安装PHPnow的解决方法.</font> </td> </tr></tbody></table> <p>一直以来本地调试php程序都喜欢用phpnow, 如今顺应趋势我也装了Windows7,却发现装phpnow并不顺利,Windows7默认用户权限较小,一般提示权限不够时,右键选择“以管理员身份运行”即可解决,但是右键运行phpnow的安装程序时,却是黑窗口一闪而过。经过一番折腾,终于搞定,以下图解Windows7下如何安装phpnow。<br>1 到C:\Windows\System32下找到cmd.exe,右键选择“以管理员身份运行”,如图所示:<br><img border="0" src="http://www.webjx.com/files/allimg/111031/1704320.jpg" width="549" height="500" alt=""></p> <p>2 切换到phpnow的安装目录,这里以E盘安装目录为phpnow为便.<br>两条命令:<br>切换到E盘:e:+Enter<br>切换到phpnow目录:cd phpnow+Enter<br>然后运行init.cmd: init.cmd+Enter<br>图示如下:<br><img border="0" src="http://www.webjx.com/files/allimg/111031/1704321.jpg" width="669" height="436" alt=""><br>3 全自动安装,然后设置SQL密码,即可见到熟悉的”PHPnow works!”页面了。</p>

    Read more +
  • 17

    2018-05
    PHP 5.4RC1发布:帮助我们识别bug

    <p> </p> <table style="BORDER-RIGHT: #cccccc 1px dotted; TABLE-LAYOUT: fixed; BORDER-TOP: #cccccc 1px dotted; BORDER-LEFT: #cccccc 1px dotted; BORDER-BOTTOM: #cccccc 1px dotted" cellspacing="0" cellpadding="6" width="95%" align="center" border="0"><tbody><tr> <td style="WORD-WRAP: break-word" bgcolor="#fdfddf"> <font color="#ff0000">WebjxCom提示:</font><font color="#000000">PHP 5.4 RC1 发布.</font> </td> </tr></tbody></table> <p style="MARGIN: 0cm 0cm 0pt" class="MsoNormal"><span class="apple-style-span"><span style="FONT-FAMILY: Verdana; COLOR: black; mso-bidi-font-size: 10.5pt" lang="EN-US">PHP</span></span><span class="apple-style-span"><span style="FONT-FAMILY: 宋体; COLOR: black; mso-bidi-font-size: 10.5pt; mso-ascii-font-family: Verdana; mso-hansi-font-family: Verdana">开发团队很荣幸的宣布</span></span><span class="apple-style-span"><span style="FONT-FAMILY: Verdana; COLOR: black; mso-bidi-font-size: 10.5pt" lang="EN-US">PHP 5.4</span></span><span style="FONT-FAMILY: Verdana; COLOR: black; FONT-WEIGHT: normal; mso-bidi-font-size: 10.5pt; mso-bidi-font-weight: bold" lang="EN-US">RC1</span><span class="apple-style-span"><span style="FONT-FAMILY: 宋体; COLOR: black; mso-bidi-font-size: 10.5pt; mso-ascii-font-family: Verdana; mso-hansi-font-family: Verdana">的发布。</span></span><span class="apple-style-span"><span style="FONT-FAMILY: Verdana; COLOR: black; mso-bidi-font-size: 10.5pt" lang="EN-US">PHP 5.4</span></span><span class="apple-style-span"><span style="FONT-FAMILY: 宋体; COLOR: black; mso-bidi-font-size: 10.5pt; mso-ascii-font-family: Verdana; mso-hansi-font-family: Verdana">包括新语言的功能并丢掉了一些不好的语音习惯(不推荐)。</span></span><span class="apple-style-span"><span style="FONT-FAMILY: Verdana; COLOR: black; mso-bidi-font-size: 10.5pt" lang="EN-US">Windows</span></span><span class="apple-style-span"><span style="FONT-FAMILY: 宋体; COLOR: black; mso-bidi-font-size: 10.5pt; mso-ascii-font-family: Verdana; mso-hansi-font-family: Verdana">二进制文件可从</span></span><span class="apple-style-span"><span style="FONT-FAMILY: Verdana; COLOR: black; mso-bidi-font-size: 10.5pt" lang="EN-US"><span style='FONT-FAMILY: "Times New Roman"; COLOR: black; TEXT-DECORATION: none; mso-bidi-font-size: 12.0pt; text-underline: none'>Windows QA</span><span style="FONT-FAMILY: 宋体; COLOR: black; TEXT-DECORATION: none; mso-bidi-font-size: 12.0pt; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; text-underline: none" lang="EN-US"><span lang="EN-US">网站上下载。</span></span></span></span></p> <p style="MARGIN: 0cm 0cm 0pt" class="MsoNormal"><span class="apple-style-span"><span style="FONT-FAMILY: Verdana; COLOR: black; mso-bidi-font-size: 10.5pt" lang="EN-US"><p></p></span></span><span class="apple-style-span"><span style="FONT-FAMILY: 宋体; COLOR: black; mso-bidi-font-size: 10.5pt; mso-ascii-font-family: Verdana; mso-hansi-font-family: Verdana">这是</span></span><span class="apple-style-span"><span style="FONT-FAMILY: Verdana; COLOR: black; mso-bidi-font-size: 10.5pt" lang="EN-US">RC----</span></span><span class="apple-style-span"><span style="FONT-FAMILY: 宋体; COLOR: black; mso-bidi-font-size: 10.5pt; mso-ascii-font-family: Verdana; mso-hansi-font-family: Verdana">不要在生产中使用</span></span><span class="apple-style-span"><span style="FONT-FAMILY: 宋体; COLOR: black; mso-bidi-font-size: 10.5pt; mso-ascii-font-family: Verdana; mso-hansi-font-family: Verdana">!</span></span><span class="apple-style-span"><span style="FONT-FAMILY: Verdana; COLOR: black; mso-bidi-font-size: 10.5pt" lang="EN-US"><p></p></span></span></p> <p style="MARGIN: 0cm 0cm 0pt" class="MsoNormal"><span class="apple-style-span"><span style="FONT-FAMILY: 宋体; COLOR: black; mso-bidi-font-size: 10.5pt; mso-ascii-font-family: Verdana; mso-hansi-font-family: Verdana">这是</span></span><span class="apple-style-span"><span style="FONT-FAMILY: Verdana; COLOR: black; mso-bidi-font-size: 10.5pt" lang="EN-US">RC1&#8212;</span></span><span class="apple-style-span"><span style="FONT-FAMILY: 宋体; COLOR: black; mso-bidi-font-size: 10.5pt; mso-ascii-font-family: Verdana; mso-hansi-font-family: Verdana">在最后的</span></span><span class="apple-style-span"><span style="FONT-FAMILY: Verdana; COLOR: black; mso-bidi-font-size: 10.5pt" lang="EN-US">PH<chsdate w:st="on" isrocdate="False" islunardate="False" day="30" month="12" year="1899">P 5.4.0</chsdate></span></span><span class="apple-style-span"><span style="FONT-FAMILY: 宋体; COLOR: black; mso-bidi-font-size: 10.5pt; mso-ascii-font-family: Verdana; mso-hansi-font-family: Verdana">版本之前没有任何新的功能。</span></span><span class="apple-style-span"><span style="FONT-FAMILY: Verdana; COLOR: black; mso-bidi-font-size: 10.5pt" lang="EN-US">RC</span></span><span class="apple-style-span"><span style="FONT-FAMILY: 宋体; COLOR: black; mso-bidi-font-size: 10.5pt; mso-ascii-font-family: Verdana; mso-hansi-font-family: Verdana">语句的旨在稳定发布之前作为修复阶段的</span></span><span class="apple-style-span"><span style="FONT-FAMILY: Verdana; COLOR: black; mso-bidi-font-size: 10.5pt" lang="EN-US">bug</span></span><span class="apple-style-span"><span style="FONT-FAMILY: 宋体; COLOR: black; mso-bidi-font-size: 10.5pt; mso-ascii-font-family: Verdana; mso-hansi-font-family: Verdana">。</span></span><span class="apple-style-span"><span style="FONT-FAMILY: Verdana; COLOR: black; mso-bidi-font-size: 10.5pt" lang="EN-US"><p></p></span></span></p> <p style="MARGIN: 0cm 0cm 0pt" class="MsoNormal"><span class="apple-style-span"><span style="FONT-FAMILY: 宋体; COLOR: black; mso-bidi-font-size: 10.5pt; mso-ascii-font-family: Verdana; mso-hansi-font-family: Verdana">自从最后一个</span></span><span class="apple-style-span"><span style="FONT-FAMILY: Verdana; COLOR: black; mso-bidi-font-size: 10.5pt" lang="EN-US">Beta</span></span><span class="apple-style-span"><span style="FONT-FAMILY: 宋体; COLOR: black; mso-bidi-font-size: 10.5pt; mso-ascii-font-family: Verdana; mso-hansi-font-family: Verdana">版本的改变包括</span></span></p> <p style="MARGIN: 0cm 0cm 0pt" class="MsoNormal"><span class="apple-style-span"><span style="FONT-FAMILY: 宋体; COLOR: black; mso-bidi-font-size: 10.5pt; mso-ascii-font-family: Verdana; mso-hansi-font-family: Verdana"></span></span><span class="apple-style-span"><span style="FONT-FAMILY: Verdana; COLOR: black; mso-bidi-font-size: 10.5pt" lang="EN-US"><p></p></span></span></p> <p style="TEXT-INDENT: -21pt; MARGIN: 0cm 0cm 0pt 21pt; mso-list: l0 level1 lfo1; tab-stops: list 21.0pt" class="MsoNormal"><span class="apple-style-span"><span style="FONT-FAMILY: Wingdings; COLOR: black; mso-bidi-font-size: 10.5pt; mso-bidi-font-weight: bold; mso-fareast-font-family: Wingdings; mso-bidi-font-family: Wingdings" lang="EN-US"><span style="mso-list: Ignore">l<span style='FONT: 7pt "Times New Roman"'> </span></span></span></span><span class="apple-style-span"><span style="FONT-FAMILY: 宋体; COLOR: black; mso-bidi-font-size: 10.5pt; mso-ascii-font-family: Verdana; mso-hansi-font-family: Verdana">通过实例增加类成员</span></span><span class="apple-style-span"><span style="FONT-FAMILY: Verdana; COLOR: black; mso-bidi-font-size: 10.5pt" lang="EN-US">(e.g. (new Foo)-&gt;bar()).<span style="mso-bidi-font-weight: bold"><p></p></span></span></span></p> <p style="TEXT-INDENT: -21pt; MARGIN: 0cm 0cm 0pt 21pt; mso-list: l0 level1 lfo1; tab-stops: list 21.0pt" class="MsoNormal"><span style="FONT-FAMILY: Wingdings; COLOR: black; FONT-WEIGHT: normal; mso-bidi-font-size: 10.5pt; mso-bidi-font-weight: bold; mso-fareast-font-family: Wingdings; mso-bidi-font-family: Wingdings" lang="EN-US"><span style="mso-list: Ignore">l<span style='FONT: 7pt "Times New Roman"'> </span></span></span><span style="FONT-FAMILY: 宋体; COLOR: black; FONT-WEIGHT: normal; mso-bidi-font-size: 10.5pt; mso-ascii-font-family: Verdana; mso-hansi-font-family: Verdana; mso-bidi-font-weight: bold">转换静默对话数组到字符串时,将产生一个通知</span></p> <p style="TEXT-INDENT: -21pt; MARGIN: 0cm 0cm 0pt 21pt; mso-list: l0 level1 lfo1; tab-stops: list 21.0pt" class="MsoNormal"><span style="FONT-FAMILY: 宋体; COLOR: black; FONT-WEIGHT: normal; mso-bidi-font-size: 10.5pt; mso-ascii-font-family: Verdana; mso-hansi-font-family: Verdana; mso-bidi-font-weight: bold"></span><span style="FONT-FAMILY: Wingdings; COLOR: black; FONT-WEIGHT: normal; mso-bidi-font-size: 10.5pt; mso-bidi-font-weight: bold; mso-fareast-font-family: Wingdings; mso-bidi-font-family: Wingdings" lang="EN-US"><span style="mso-list: Ignore">l<span style='FONT: 7pt "Times New Roman"'> </span></span></span><span style="FONT-FAMILY: 宋体; COLOR: black; FONT-WEIGHT: normal; mso-bidi-font-size: 10.5pt; mso-ascii-font-family: Verdana; mso-hansi-font-family: Verdana; mso-bidi-font-weight: bold">在内核和更多的扩展中修复更多错误和改进</span></p> <p style="TEXT-INDENT: -21pt; MARGIN: 0cm 0cm 0pt 21pt; mso-list: l0 level1 lfo1; tab-stops: list 21.0pt" class="MsoNormal"><span style="FONT-FAMILY: 宋体; COLOR: black; FONT-WEIGHT: normal; mso-bidi-font-size: 10.5pt; mso-ascii-font-family: Verdana; mso-hansi-font-family: Verdana; mso-bidi-font-weight: bold"></span><span style="FONT-FAMILY: Verdana; COLOR: black; FONT-WEIGHT: normal; mso-bidi-font-size: 10.5pt; mso-bidi-font-weight: bold" lang="EN-US"><p></p></span><span style="FONT-FAMILY: 宋体; COLOR: black; FONT-WEIGHT: normal; mso-bidi-font-size: 10.5pt; mso-ascii-font-family: Verdana; mso-hansi-font-family: Verdana; mso-bidi-font-weight: bold">请帮助我们识别</span><span style="FONT-FAMILY: Verdana; COLOR: black; FONT-WEIGHT: normal; mso-bidi-font-size: 10.5pt; mso-bidi-font-weight: bold" lang="EN-US">bug</span><span style="FONT-FAMILY: 宋体; COLOR: black; FONT-WEIGHT: normal; mso-bidi-font-size: 10.5pt; mso-ascii-font-family: Verdana; mso-hansi-font-family: Verdana; mso-bidi-font-weight: bold">,以确保发布固定和所有的事情像预期的那样。</span><span style="FONT-FAMILY: Verdana; COLOR: black; FONT-WEIGHT: normal; mso-bidi-font-size: 10.5pt; mso-bidi-font-weight: bold" lang="EN-US"><p></p></span></p>

    Read more +
  • 17

    2018-05
    PHP资源:免费的实用的PHP类库免费下载

    <p> </p> <table style="BORDER-RIGHT: #cccccc 1px dotted; TABLE-LAYOUT: fixed; BORDER-TOP: #cccccc 1px dotted; BORDER-LEFT: #cccccc 1px dotted; BORDER-BOTTOM: #cccccc 1px dotted" cellspacing="0" cellpadding="6" width="95%" align="center" border="0"><tbody><tr> <td style="WORD-WRAP: break-word" bgcolor="#fdfddf"> <font color="#ff0000">WebjxCom提示:</font><font color="#000000">开源已渐渐成为主流,每天都会有许多框架或类库开源,而开发者利用这些开源工具来简化工作任务、提高工作效率则是一个不错的选择。本文为开发者整理了15个非常实用的PHP开源框架/类库。</font> </td> </tr></tbody></table> <p style="font: 14px/24px Helvetica, Tahoma, Arial, sans-serif; list-style: none; margin: 0px 0px 1.5em; padding: 0px; text-align: left; color: rgb(51, 51, 51); text-transform: none; text-indent: 0px; letter-spacing: normal; text-decoration: none; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;">PHP库给开发者提供了一个标准接口,它帮助开发者在PHP里充分利用面向对象编程。这些库为特定类型的内置功能提供了一个标准的API,允许类可以与PHP引擎进行无缝的交互。此外,开发者使用这些类库还可以简化工作流程,提供工作效率。</p> <p style="font: 14px/24px Helvetica, Tahoma, Arial, sans-serif; list-style: none; margin: 0px 0px 1.5em; padding: 0px; text-align: left; color: rgb(51, 51, 51); text-transform: none; text-indent: 0px; letter-spacing: normal; text-decoration: none; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;">下面就一起来看看这些非常实用且免费的类库吧,希望它们能助你一臂之力。</p> <p style="font: 14px/24px Helvetica, Tahoma, Arial, sans-serif; list-style: none; margin: 0px 0px 1.5em; padding: 0px; text-align: left; color: rgb(51, 51, 51); text-transform: none; text-indent: 0px; letter-spacing: normal; text-decoration: none; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;"><strong>1.<a style="color: rgb(0, 102, 204); text-decoration: none; cursor: pointer;" href="http://requests.ryanmccue.info/" target="_blank">Requests</a></strong></p> <p style="font: 14px/24px Helvetica, Tahoma, Arial, sans-serif; list-style: none; margin: 0px 0px 1.5em; padding: 0px; text-align: center; color: rgb(51, 51, 51); text-transform: none; text-indent: 0px; letter-spacing: normal; text-decoration: none; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;"><a style="color: rgb(0, 102, 204); text-decoration: none; cursor: pointer;" href="/files/allimg/131009/2213400.jpg" target="_blank"><img style="border: currentColor; width: 592.4px; height: 324px; vertical-align: middle;" src="http://www.webjx.com/files/allimg/131009/2213400.jpg" border="0" alt=""></a><br></p> <p style="font: 14px/24px Helvetica, Tahoma, Arial, sans-serif; list-style: none; margin: 0px 0px 1.5em; padding: 0px; text-align: left; color: rgb(51, 51, 51); text-transform: none; text-indent: 0px; letter-spacing: normal; text-decoration: none; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;">Requests是一个用PHP编写的HTTP库,遵循ISC开源协议,托管在GitHub上。Requests取代了Python HTTP/1.1以外的一切工作&#8212;&#8212;&#8212;让你与Web服务可以无缝的结合。</p> <p style="font: 14px/24px Helvetica, Tahoma, Arial, sans-serif; list-style: none; margin: 0px 0px 1.5em; padding: 0px; text-align: left; color: rgb(51, 51, 51); text-transform: none; text-indent: 0px; letter-spacing: normal; text-decoration: none; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;">Requests提供了一致的API,并且使用cURL或fsockopen(具体取决于可用性),它还简化了发送请求,接受HEAD、GET、POST、PUT、DELETE或PATCH并且添加标头、表单数据和多个部分组成的文件。其次,该库还适用于国际域名、身份验证、自动压缩gzip压缩响应等。综上所述可以看出,Requests是一个非常好用且可以友好托管HTTP请求的标签。<br></p> <p style="font: 14px/24px Helvetica, Tahoma, Arial, sans-serif; list-style: none; margin: 0px 0px 1.5em; padding: 0px; text-align: left; color: rgb(51, 51, 51); text-transform: none; text-indent: 0px; letter-spacing: normal; text-decoration: none; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;"><strong>2.<a style="color: rgb(0, 102, 204); text-decoration: none; cursor: pointer;" href="http://mun.ee/" target="_blank">Munee</a></strong></p> <p style="font: 14px/24px Helvetica, Tahoma, Arial, sans-serif; list-style: none; margin: 0px 0px 1.5em; padding: 0px; text-align: center; color: rgb(51, 51, 51); text-transform: none; text-indent: 0px; letter-spacing: normal; text-decoration: none; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;"><a style="color: rgb(0, 102, 204); text-decoration: none; cursor: pointer;" href="/files/allimg/131009/2213401.jpg" target="_blank"><img style="border: currentColor; vertical-align: middle;" src="http://www.webjx.com/files/allimg/131009/2213401.jpg" border="0" alt=""></a>&#160;</p> <p style="font: 14px/24px Helvetica, Tahoma, Arial, sans-serif; list-style: none; margin: 0px 0px 1.5em; padding: 0px; text-align: left; color: rgb(51, 51, 51); text-transform: none; text-indent: 0px; letter-spacing: normal; text-decoration: none; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;">Munee是一个集图片尺寸调整、CSS-JS合并/压缩、缓存等功能于一身的PHP库。可以在服务器端和客户端缓存资源。它集成了PHP图片操作库Imagine来实现图片尺寸调整和剪切,之后进行缓存。<br></p> <p style="font: 14px/24px Helvetica, Tahoma, Arial, sans-serif; list-style: none; margin: 0px 0px 1.5em; padding: 0px; text-align: left; color: rgb(51, 51, 51); text-transform: none; text-indent: 0px; letter-spacing: normal; text-decoration: none; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;">Munee可以自动编译LESS、SCSS和CoffeeScript,并且可以把CSS+JS文件合并成一个单一的请求,此外,还可以对这些CSS-JS文件进行精缩,让其拥有更好的性能表现。该库还可以轻易地与任何代码集成。<br></p> <p style="font: 14px/24px Helvetica, Tahoma, Arial, sans-serif; list-style: none; margin: 0px 0px 1.5em; padding: 0px; text-align: left; color: rgb(51, 51, 51); text-transform: none; text-indent: 0px; letter-spacing: normal; text-decoration: none; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;"><strong>3.<a style="color: rgb(0, 102, 204); text-decoration: none; cursor: pointer;" href="http://socketo.me/" target="_blank">Ratchet&#160;</a></strong></p> <p style="font: 14px/24px Helvetica, Tahoma, Arial, sans-serif; list-style: none; margin: 0px 0px 1.5em; padding: 0px; text-align: center; color: rgb(51, 51, 51); text-transform: none; text-indent: 0px; letter-spacing: normal; text-decoration: none; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;"><a style="color: rgb(0, 102, 204); text-decoration: none; cursor: pointer;" href="/files/allimg/131009/2213402.jpg" target="_blank"><img style="border: currentColor; vertical-align: middle;" src="http://www.webjx.com/files/allimg/131009/2213402.jpg" border="0" alt=""></a><br></p> <p style="font: 14px/24px Helvetica, Tahoma, Arial, sans-serif; list-style: none; margin: 0px 0px 1.5em; padding: 0px; text-align: left; color: rgb(51, 51, 51); text-transform: none; text-indent: 0px; letter-spacing: normal; text-decoration: none; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;">Ratchet是一个PHP库、WebSockets工具包,开发者可以使用它在客户端和服务器端之间构建实时、双向的App应用,并且可以快速简单地构建事件驱动应用程序(而不是传统的HTTP 请求/响应应用程序)。<br></p> <p style="font: 14px/24px Helvetica, Tahoma, Arial, sans-serif; list-style: none; margin: 0px 0px 1.5em; padding: 0px; text-align: left; color: rgb(51, 51, 51); text-transform: none; text-indent: 0px; letter-spacing: normal; text-decoration: none; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;"><strong>4.<a style="color: rgb(0, 102, 204); text-decoration: none; cursor: pointer;" href="http://swiftmailer.org/" target="_blank">Swift Mailer</a></strong></p> <p style="font: 14px/24px Helvetica, Tahoma, Arial, sans-serif; list-style: none; margin: 0px 0px 1.5em; padding: 0px; text-align: left; color: rgb(51, 51, 51); text-transform: none; text-indent: 0px; letter-spacing: normal; text-decoration: none; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;"><a style="color: rgb(0, 102, 204); text-decoration: none; cursor: pointer;" href="/files/allimg/131009/2213403.jpg" target="_blank"><img style="border: currentColor; vertical-align: middle;" src="http://www.webjx.com/files/allimg/131009/2213403.jpg" border="0" alt=""></a><br></p> <p style="font: 14px/24px Helvetica, Tahoma, Arial, sans-serif; list-style: none; margin: 0px 0px 1.5em; padding: 0px; text-align: left; color: rgb(51, 51, 51); text-transform: none; text-indent: 0px; letter-spacing: normal; text-decoration: none; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;">Swift Mailer是一个功能丰富的PHP邮件库,不依赖于PHP自带的mail() 函数,因为该函数在发送多个邮件时占用的系统资源很高。Swift直接与SMTP服务器通讯,具有非常高的发送速度和效率。&#160;</p> <p style="font: 14px/24px Helvetica, Tahoma, Arial, sans-serif; list-style: none; margin: 0px 0px 1.5em; padding: 0px; text-align: left; color: rgb(51, 51, 51); text-transform: none; text-indent: 0px; letter-spacing: normal; text-decoration: none; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;"><strong>5.<a style="color: rgb(0, 102, 204); text-decoration: none; cursor: pointer;" href="http://unirest.io/" target="_blank">Unirest&#160;</a></strong></p> <p style="font: 14px/24px Helvetica, Tahoma, Arial, sans-serif; list-style: none; margin: 0px 0px 1.5em; padding: 0px; text-align: center; color: rgb(51, 51, 51); text-transform: none; text-indent: 0px; letter-spacing: normal; text-decoration: none; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;"><a style="color: rgb(0, 102, 204); text-decoration: none; cursor: pointer;" href="/files/allimg/131009/2213404.jpg" target="_blank"><img style="border: currentColor; vertical-align: middle;" src="http://www.webjx.com/files/allimg/131009/2213404.jpg" border="0" alt=""></a><br></p> <p style="font: 14px/24px Helvetica, Tahoma, Arial, sans-serif; list-style: none; margin: 0px 0px 1.5em; padding: 0px; text-align: left; color: rgb(51, 51, 51); text-transform: none; text-indent: 0px; letter-spacing: normal; text-decoration: none; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;">Unirest是一个轻量级的HTTP开发库,可用于PHP、Ruby、Python、Java、Objective-C等开发语言。支持GET、POST、PUT、UPDATE、DELETE操作,它的调用方法与返回结果对所有开发语言来说,都是相同的。</p> <p style="font: 14px/24px Helvetica, Tahoma, Arial, sans-serif; list-style: none; margin: 0px 0px 1.5em; padding: 0px; text-align: left; color: rgb(51, 51, 51); text-transform: none; text-indent: 0px; letter-spacing: normal; text-decoration: none; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;"><strong>6.<a style="color: rgb(0, 102, 204); text-decoration: none; cursor: pointer;" href="http://detector.dmolsen.com/" target="_blank">Detector</a></strong></p> <p style="font: 14px/24px Helvetica, Tahoma, Arial, sans-serif; list-style: none; margin: 0px 0px 1.5em; padding: 0px; text-align: left; color: rgb(51, 51, 51); text-transform: none; text-indent: 0px; letter-spacing: normal; text-decoration: none; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;"><a style="color: rgb(0, 102, 204); text-decoration: none; cursor: pointer;" href="/files/allimg/131009/2213405.jpg" target="_blank"><img style="border: currentColor; vertical-align: middle;" src="http://www.webjx.com/files/allimg/131009/2213405.jpg" border="0" alt=""></a><br></p> <p style="font: 14px/24px Helvetica, Tahoma, Arial, sans-serif; list-style: none; margin: 0px 0px 1.5em; padding: 0px; text-align: left; color: rgb(51, 51, 51); text-transform: none; text-indent: 0px; letter-spacing: normal; text-decoration: none; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;">Detector是一个开源的PHP类库,用于检测用户的浏览器环境。它可以获得浏览器的使用情况和浏览器的HTML5 CSS3功能、并分析是否是移动、平板电脑、桌面或网页爬虫和其他项,如:颜色深度、 视频尺寸、Cookie等。该库对每个浏览器用户都使用单一的用户代理字符串来自动适应新浏览器、版本和设备。</p> <p style="font: 14px/24px Helvetica, Tahoma, Arial, sans-serif; list-style: none; margin: 0px 0px 1.5em; padding: 0px; text-align: left; color: rgb(51, 51, 51); text-transform: none; text-indent: 0px; letter-spacing: normal; text-decoration: none; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;"><strong>7.<a style="color: rgb(0, 102, 204); text-decoration: none; cursor: pointer;" href="http://phpthumb.sourceforge.net/" target="_blank">PHP Thumb</a></strong></p> <p style="font: 14px/24px Helvetica, Tahoma, Arial, sans-serif; list-style: none; margin: 0px 0px 1.5em; padding: 0px; text-align: center; color: rgb(51, 51, 51); text-transform: none; text-indent: 0px; letter-spacing: normal; text-decoration: none; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;"><strong><a style="color: rgb(0, 102, 204); text-decoration: none; cursor: pointer;" href="/files/allimg/131009/2213406.jpg" target="_blank"><img style="border: currentColor; vertical-align: middle;" src="http://www.webjx.com/files/allimg/131009/2213406.jpg" border="0" alt=""></a><br></strong></p> <p style="font: 14px/24px Helvetica, Tahoma, Arial, sans-serif; list-style: none; margin: 0px 0px 1.5em; padding: 0px; text-align: left; color: rgb(51, 51, 51); text-transform: none; text-indent: 0px; letter-spacing: normal; text-decoration: none; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;">PHP Thumb是一个PHP类,用来生成图片的缩略图。 只需数行代码即可,支持多种图片来源,包括文件系统或者数据库,支持大多数图片格式。并可对图片进行旋转、剪切、加水印等等。可自定义缩略图的质量,提供内建的缓存以降低服务器的负载。<br></p> <p style="font: 14px/24px Helvetica, Tahoma, Arial, sans-serif; list-style: none; margin: 0px 0px 1.5em; padding: 0px; text-align: left; color: rgb(51, 51, 51); text-transform: none; text-indent: 0px; letter-spacing: normal; text-decoration: none; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;"><strong>8.<a style="color: rgb(0, 102, 204); text-decoration: none; cursor: pointer;" href="http://stefangabos.ro/php-libraries/zebra-image/" target="_blank">Zebra Image</a></strong></p> <p style="font: 14px/24px Helvetica, Tahoma, Arial, sans-serif; list-style: none; margin: 0px 0px 1.5em; padding: 0px; text-align: center; color: rgb(51, 51, 51); text-transform: none; text-indent: 0px; letter-spacing: normal; text-decoration: none; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;"><a style="color: rgb(0, 102, 204); text-decoration: none; cursor: pointer;" href="/files/allimg/131009/2213407.jpg" target="_blank"><img style="border: currentColor; vertical-align: middle;" src="http://www.webjx.com/files/allimg/131009/2213407.jpg" border="0" alt=""></a><br></p> <p style="font: 14px/24px Helvetica, Tahoma, Arial, sans-serif; list-style: none; margin: 0px 0px 1.5em; padding: 0px; text-align: left; color: rgb(51, 51, 51); text-transform: none; text-indent: 0px; letter-spacing: normal; text-decoration: none; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;">Zebra Image是一个开源的轻量级图像处理库,并且是一款面向对象库,只需PHP GD2扩展,并支持缩放、裁剪、旋转和翻转操作。它可以用于.jpg、.gif、.png等格式。<br></p> <p style="font: 14px/24px Helvetica, Tahoma, Arial, sans-serif; list-style: none; margin: 0px 0px 1.5em; padding: 0px; text-align: left; color: rgb(51, 51, 51); text-transform: none; text-indent: 0px; letter-spacing: normal; text-decoration: none; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;"><strong>9.<a style="color: rgb(0, 102, 204); text-decoration: none; cursor: pointer;" href="http://hybridauth.sourceforge.net/" target="_blank">Hybrid Auth</a></strong></p> <p style="font: 14px/24px Helvetica, Tahoma, Arial, sans-serif; list-style: none; margin: 0px 0px 1.5em; padding: 0px; text-align: left; color: rgb(51, 51, 51); text-transform: none; text-indent: 0px; letter-spacing: normal; text-decoration: none; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;"><a style="color: rgb(0, 102, 204); text-decoration: none; cursor: pointer;" href="/files/allimg/131009/2213408.jpg" target="_blank"><img style="border: currentColor; vertical-align: middle;" src="http://www.webjx.com/files/allimg/131009/2213408.jpg" border="0" alt=""></a><br></p> <p style="font: 14px/24px Helvetica, Tahoma, Arial, sans-serif; list-style: none; margin: 0px 0px 1.5em; padding: 0px; text-align: left; color: rgb(51, 51, 51); text-transform: none; text-indent: 0px; letter-spacing: normal; text-decoration: none; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;">HybridAuth是一个开源PHP类库,用于通过微博/社交网站和ID来提供验证功能实现同步登录网站功能。它能够很方便的与现有网站相集成,只要引用一个文件并添加几行代码就能够实现登录。一旦验证,HybridAuth会提供连接用户的标准化相关资料。此外,除了验证功能,这个类库能够让我们与用户连接的social API客户端相交互。<br></p> <p style="font: 14px/24px Helvetica, Tahoma, Arial, sans-serif; list-style: none; margin: 0px 0px 1.5em; padding: 0px; text-align: left; color: rgb(51, 51, 51); text-transform: none; text-indent: 0px; letter-spacing: normal; text-decoration: none; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;"><strong>10.&#160;<a style="color: rgb(0, 102, 204); text-decoration: none; cursor: pointer;" href="http://bastianallgeier.com/gantti/" target="_blank">Gantt Charts</a></strong></p> <p style="font: 14px/24px Helvetica, Tahoma, Arial, sans-serif; list-style: none; margin: 0px 0px 1.5em; padding: 0px; text-align: left; color: rgb(51, 51, 51); text-transform: none; text-indent: 0px; letter-spacing: normal; text-decoration: none; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;"><a style="color: rgb(0, 102, 204); text-decoration: none; cursor: pointer;" href="/files/allimg/131009/2213409.jpg" target="_blank"><img style="border: currentColor; vertical-align: middle;" src="http://www.webjx.com/files/allimg/131009/2213409.jpg" border="0" alt=""></a><br></p> <p style="font: 14px/24px Helvetica, Tahoma, Arial, sans-serif; list-style: none; margin: 0px 0px 1.5em; padding: 0px; text-align: left; color: rgb(51, 51, 51); text-transform: none; text-indent: 0px; letter-spacing: normal; text-decoration: none; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;">Gantti是一个开源的PHP类,帮助用户即时生成Gantt图表。使用Gantti创建图表无需使用JavaScript,是纯HTML5-CSS3。图表默认输出非常漂亮,但用户可以自定义样式进行输出(SASS样式表)。<br></p> <p style="font: 14px/24px Helvetica, Tahoma, Arial, sans-serif; list-style: none; margin: 0px 0px 1.5em; padding: 0px; text-align: left; color: rgb(51, 51, 51); text-transform: none; text-indent: 0px; letter-spacing: normal; text-decoration: none; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;"><strong>11.<a style="color: rgb(0, 102, 204); text-decoration: none; cursor: pointer;" href="http://mobiledetect.net/" target="_blank">Mobile Detect&#160;</a></strong></p> <p style="font: 14px/24px Helvetica, Tahoma, Arial, sans-serif; list-style: none; margin: 0px 0px 1.5em; padding: 0px; text-align: center; color: rgb(51, 51, 51); text-transform: none; text-indent: 0px; letter-spacing: normal; text-decoration: none; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;"><a style="color: rgb(0, 102, 204); text-decoration: none; cursor: pointer;" href="/files/allimg/131009/22134010.jpg" target="_blank"><img style="border: currentColor; vertical-align: middle;" src="http://www.webjx.com/files/allimg/131009/22134010.jpg" border="0" alt=""></a><br></p> <p style="font: 14px/24px Helvetica, Tahoma, Arial, sans-serif; list-style: none; margin: 0px 0px 1.5em; padding: 0px; text-align: left; color: rgb(51, 51, 51); text-transform: none; text-indent: 0px; letter-spacing: normal; text-decoration: none; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;">Mobile Detect是一个PHP类,通过User-Agent检测各种手机设备,并结合HTTP Header来检测移动设备环境。该类库最强大的地方是,它有一个非常完整的库,可以检测出所用的设备类型(包括操作类型、以及手机品牌等都能检测)和浏览器的详细信息。<br></p> <p style="font: 14px/24px Helvetica, Tahoma, Arial, sans-serif; list-style: none; margin: 0px 0px 1.5em; padding: 0px; text-align: left; color: rgb(51, 51, 51); text-transform: none; text-indent: 0px; letter-spacing: normal; text-decoration: none; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;"><strong>12.<a style="color: rgb(0, 102, 204); text-decoration: none; cursor: pointer;" href="http://phpimageworkshop.com/" target="_blank">ImageWorkshop</a></strong></p> <p style="font: 14px/24px Helvetica, Tahoma, Arial, sans-serif; list-style: none; margin: 0px 0px 1.5em; padding: 0px; text-align: center; color: rgb(51, 51, 51); text-transform: none; text-indent: 0px; letter-spacing: normal; text-decoration: none; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;"><a style="color: rgb(0, 102, 204); text-decoration: none; cursor: pointer;" href="/files/allimg/131009/22134011.jpg" target="_blank"><img style="border: currentColor; vertical-align: middle;" src="http://www.webjx.com/files/allimg/131009/22134011.jpg" border="0" alt=""></a><br></p> <p style="font: 14px/24px Helvetica, Tahoma, Arial, sans-serif; list-style: none; margin: 0px 0px 1.5em; padding: 0px; text-align: left; color: rgb(51, 51, 51); text-transform: none; text-indent: 0px; letter-spacing: normal; text-decoration: none; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;">顾名思义,ImageWorkshop是一个管理和操作图片的PHP类库,这个类拥有类似图片编辑软件的逻辑:基于层的概念,可以叠加很多层或层组(每一层不同的操纵选项)。它还支持许多功能,比如水印、裁剪、移动、缩放、旋转、叠加等。</p> <p style="font: 14px/24px Helvetica, Tahoma, Arial, sans-serif; list-style: none; margin: 0px 0px 1.5em; padding: 0px; text-align: left; color: rgb(51, 51, 51); text-transform: none; text-indent: 0px; letter-spacing: normal; text-decoration: none; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;"><strong>13.<a style="color: rgb(0, 102, 204); text-decoration: none; cursor: pointer;" href="http://www.jqmphp.com/" target="_blank">JqmPhp</a></strong></p> <p style="font: 14px/24px Helvetica, Tahoma, Arial, sans-serif; list-style: none; margin: 0px 0px 1.5em; padding: 0px; text-align: left; color: rgb(51, 51, 51); text-transform: none; text-indent: 0px; letter-spacing: normal; text-decoration: none; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;"><a style="color: rgb(0, 102, 204); text-decoration: none; cursor: pointer;" href="/files/allimg/131009/22134012.jpg" target="_blank"><img style="border: currentColor; vertical-align: middle;" src="http://www.webjx.com/files/allimg/131009/22134012.jpg" border="0" alt=""></a><br></p> <p style="font: 14px/24px Helvetica, Tahoma, Arial, sans-serif; list-style: none; margin: 0px 0px 1.5em; padding: 0px; text-align: left; color: rgb(51, 51, 51); text-transform: none; text-indent: 0px; letter-spacing: normal; text-decoration: none; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;">JqmPhp是一个PHP开源类库,旨在简化jQuery与PHP来进行移动开发,用于生成使用jQuery Mobile框架所需要的HTML文件。该类库的文件是独立的,所以你可以根据需要来选择使用。<br></p> <p style="font: 14px/24px Helvetica, Tahoma, Arial, sans-serif; list-style: none; margin: 0px 0px 1.5em; padding: 0px; text-align: left; color: rgb(51, 51, 51); text-transform: none; text-indent: 0px; letter-spacing: normal; text-decoration: none; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;"><strong>14.<a style="color: rgb(0, 102, 204); text-decoration: none; cursor: pointer;" href="http://nielse63.github.io/php-image-cache/" target="_blank">PHP Image Cache</a></strong></p> <p style="font: 14px/24px Helvetica, Tahoma, Arial, sans-serif; list-style: none; margin: 0px 0px 1.5em; padding: 0px; text-align: center; color: rgb(51, 51, 51); text-transform: none; text-indent: 0px; letter-spacing: normal; text-decoration: none; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;"><strong><a style="color: rgb(0, 102, 204); text-decoration: none; cursor: pointer;" href="/files/allimg/131009/22134013.jpg" target="_blank"><img style="border: currentColor; vertical-align: middle;" src="http://www.webjx.com/files/allimg/131009/22134013.jpg" border="0" alt=""></a><br></strong></p> <p style="font: 14px/24px Helvetica, Tahoma, Arial, sans-serif; list-style: none; margin: 0px 0px 1.5em; padding: 0px; text-align: left; color: rgb(51, 51, 51); text-transform: none; text-indent: 0px; letter-spacing: normal; text-decoration: none; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;">Image Cache是一个轻量级的PHP类,可以在用户浏览器里压缩、移动、缓存图片。这个类提供一些简单的设置如:目录、根路径URL等,然后针对每一张图片调用压缩功能。<br></p> <p style="font: 14px/24px Helvetica, Tahoma, Arial, sans-serif; list-style: none; margin: 0px 0px 1.5em; padding: 0px; text-align: left; color: rgb(51, 51, 51); text-transform: none; text-indent: 0px; letter-spacing: normal; text-decoration: none; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;"><strong>15.<a style="color: rgb(0, 102, 204); text-decoration: none; cursor: pointer;" href="http://imagine.readthedocs.org/en/latest/" target="_blank">Imagine</a></strong></p> <p style="font: 14px/24px Helvetica, Tahoma, Arial, sans-serif; list-style: none; margin: 0px 0px 1.5em; padding: 0px; text-align: left; color: rgb(51, 51, 51); text-transform: none; text-indent: 0px; letter-spacing: normal; text-decoration: none; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;"><a style="color: rgb(0, 102, 204); text-decoration: none; cursor: pointer;" href="/files/allimg/131009/22134014.jpg" target="_blank"><img style="border: currentColor; vertical-align: middle;" src="http://www.webjx.com/files/allimg/131009/22134014.jpg" border="0" alt=""></a><br></p> <p style="font: 14px/24px Helvetica, Tahoma, Arial, sans-serif; list-style: none; margin: 0px 0px 1.5em; padding: 0px; text-align: left; color: rgb(51, 51, 51); text-transform: none; text-indent: 0px; letter-spacing: normal; text-decoration: none; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;">Imagine是一个面向对象的PHP类库,用于图片操作。这个类库能够处理一些经常用到的操作如:缩放、裁剪、应用过滤等。其Color类库可用于对任意特定的颜色生成RGB值。并且还提供一些方法来绘制图形如:圆弧、椭圆、线、片等。</p> <p style="font: 14px/24px Helvetica, Tahoma, Arial, sans-serif; list-style: none; margin: 0px 0px 1.5em; padding: 0px; text-align: left; color: rgb(51, 51, 51); text-transform: none; text-indent: 0px; letter-spacing: normal; text-decoration: none; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;">来自:<a style="color: rgb(0, 102, 204); text-decoration: none; cursor: pointer;" href="http://codegeekz.com/useful-php-libraries-and-classes-for-developers/" target="_blank">CodeGeekz</a></p>

    Read more +