PHP's tag archives

How to use Gzip to load your site faster in 5 minutes

This tutorial will only examine one particular way of implementing Gzip compression with PHP, but there is another way to accomplish it with Apache if you have administration access to your server. Step 1: Enable zlib compression in php. You can do this many ways, just choose one: * Add a line to your .htaccess file: [code]php_flag zlib.output_compression On[/code] * Add or change a line in your php.ini file: [code] output_buffering = Off output_handler = zlib.output_compres...

Dynamic Website SEO

Dynamic content used to be a red flag for search engine friendly design, but times have changed. Search engines now include dynamically-generated pages in their indexes, but some particulars of dynamic pages can still be obstacles to getting indexed. Whether it’s keeping in synch with inventory or updating a blog, more than likely if you’re a website owner you have some level of dynamic or CMS-managed content on your site (and if n...

国内外主流免费asp/php个人博客(Blog)程序评测

一、ASP类,对于只学习了 Html 语言的同学来说,ASP 是比较容易上手的,因此也是目前我所推荐的。 1、Zblog,由创始人zx.asd(朱煊)和sipo(刘星晨)联合开发的ASP+Access单用户博客系统,最新版本是 Z-Blog 1.8 Spirit。我曾经体验过一段时间的Zblog 1.7,后来由于个人原因而放弃。该程序最大的特点就是支持文章静态化,有利于搜索引擎的收录。另外,Z-Blog 支持在线安装主题和插件,支持Windows Live Writer 离线可视化写博,大大提高了博客管理的效率。Z-Blog 在国内有大量用户,因此皮肤、插件都很多,可以实现很多个性化功能。 官方网站:http://www.rainbowsoft.org/ 2、PJBlog,由在腾讯负责Q-zone的前台JS设计的 PuterJam(陈子舜)独自开发的基于ASP+Access的单用户博客系统,最新版本是PJBlog3 v2.8.2.117,最新版也解决了日志静态化的问题(当年我盼这个功能盼得好苦啊)。PJBlog 具有丰富的插件和模板,良好的可扩展功能,在国内...

优化PHP执行效率的40条技巧

1.如果一个方法能被静态,那就声明他为静态的,速度可提高1/4; 2.echo的效率高于print,因为echo没有返回值,print返回一个整型; 3.在循环之前设置循环的最大次数,而非在在循环中; 4.销毁变量去释放内存,特别是大的数组; 5.避免使用像__get, __set, __autoload等魔术方法; 6.requiere_once()比较耗资源; 7.在includes和requires中使用绝对路径,这样在分析路径花的时间更少; 8.如果你需要得sexinsex到脚本执行时的时间,$_SERVER['REQUSET_TIME']优于time(); 9.能使用字符处理函数的,尽量用他们,因为效率高于正则; 10.str_replace字符替换比正则替换preg_replace快,但strtr比str_replace又快1/4; 11.如果一个函数既能接受数组又能接受简单字符做为参数,例如字符替换,并且参数列表不是太长,可以考虑多用一些简洁的替换语句,一次只替换一个字符,而不是接受数组做为查找和替换参数。大...

Top Ten Open Source PHP Apps

Open-source PHP applications that changed the world. From managing databases to shopping, writing blogs to sending emails. Ten years of passion, great software architectures, team work and revolutionary ideas. Here are the most influential open-source PHP applications. Blog Wordpress - is a state-of-the-art semantic personal publishing platform with a focus on aesthetics, web standards, and usability. BBS phpBB -is a high powered, fully scalable, and highly customizable open-s...

PHP生成图片E-mail地址

mail.php代码 [php] <? /* MailX Managment System 0.8 Beta */ header("Content-type:image/png"); $mailaddress=$_GET['mailname']; $mailaddresslen=strlen($mailaddress); $mailaddressimages=imagecreate($mailaddresslen*10,25); $lenadd=$mailaddresslen; $fontsize="4"; $center=(imagesx($mailaddressimages)-8.3*strlen($mailaddress))/2; $mailimagesbackground=ImageColorAllocate($mailaddressimages,255,255,255); $mailimagesfacecolor=ImageColorAllocate($mailaddressimages,0,0,...

Using PHP to get real ip address and complete url

[code] <?php function get_ip() { if ($_SERVER) { if ($_SERVER["HTTP_X_FORWARDED_FOR"] ) { $realip = $_SERVER["HTTP_X_FORWARDED_FOR"]; } elseif ( $_SERVER["HTTP_CLIENT_ip"] ) { $realip = $_SERVER["HTTP_CLIENT_ip"]; } else { $realip = $_SERVER["REMOTE_ADDR"]; } } else { if ( getenv( 'HTTP_X_FORWARDED_FOR' ) ) { $realip = getenv( 'HTTP_X_FORWARDED_FOR' ); } elseif ( getenv( 'HTTP_CLIENT_ip' )...

几个PHP的通用检测函数

[php]<? // ※CheckMoney($C_Money) 检查数据是否是99999.99格式 // ※CheckEmailAddr($C_mailaddr) 判断是否为有效邮件地址 // ※CheckWebAddr($C_weburl) 判断是否为有效网址 // ※CheckEmpty($C_char) 判断字符串是否为空 // ※CheckLengthBetween($C_char, $I_len1, $I_len2=100) 判断是否为指定长度内字符串 // ※CheckUser($C_user) 判断是否为合法用户名 // ※CheckPassword($C_passwd) 判断是否为合法用户密码 // ※CheckTelephone($C_telephone) 判断是否为合法电话号码 // ※CheckValueBetween($N_var, $N_val1, $N_val2) 判断是否是某一范围内的合法值 // ※CheckPost($C_post) 判断是否为合法邮编(固定长度) // ※CheckExtendName($C_filena...