Tag Archives: php

odtphp: A nice library to output openoffice odt file

Recently, I want to add a function in our data center website(Which is only Chinese version now, an English version is preparing): “output the geographic metadata to openoffice odt format”. So, the odtphp project came into my sight. After download … Continue reading

Posted in Program | Tagged , , , , | Leave a comment

推荐:PHPFetion,飞信的PHP类实现

PHPFetion: http://code.google.com/p/php-fetion/ 作者BLOG:http://blog.quanhz.com 实现原理 用PHP的socket函数发送HTTP请求,模拟登录WAP版的飞信,并模拟发送飞信。 具体实现细节可查看此文:用PHP模拟登录WAP飞信实现飞信发送,不过原文中是用curl来实现的,道理相同。 我用此类,在服务器上又可以实现天气预报的定时发送,还能发送服务器重启信息给自己。

Posted in Linux | Tagged , | Leave a comment

用PHP处理中文PDF

因项目需要,现在想在服务器端动态生成PDF文件,已一个PDF为模板,然后把所需的数据动态填入。 本来在使用zend framework,因此很直接的就使用zend_pdf类来进行测试,代码实现如下: $pdf = Zend_Pdf::load($this->view->config->offline->template); $pdf->pages = array_reverse($pdf->pages); $style = new Zend_Pdf_Style(); $font = Zend_Pdf_Font::fontWithPath($this->view->config->offline->font, ( Zend_Pdf_Font::EMBED_DONT_SUBSET)); $pdf->pages[0]->setFont($font, 10); $pdf->pages[0]->saveGS(); //datalist $pdf->pages[0]->drawText(str_replace(“;”,”\n”,$datalist), 100, 570,”UTF-8″); //project $pdf->pages[0]->drawText($formData['project'], 100, 430,”UTF-8″); $pdf->pages[0]->drawText($formData['realname'], 100, 78,”UTF-8″); $pdf->pages[0]->drawText($formData['realname'], 130, 590,”UTF-8″); $pdf->pages[0]->drawText($formData['unit'], 95, 58,”UTF-8″); $pdf->pages[0]->drawText($formData['address'], 285, … Continue reading

Posted in Program | Tagged , , , , , , | 1 Comment

ubuntu hardy下使用zend framework

安装: sudo aptitude install zend-framework 补充操作: 1 添加Zend符号连接 sudo ln -s /usr/share/php/libzend-framework-php/Zend /usr/share/php/Zend 2 修补中文EMAIL的subject乱码 参考http://framework.zend.com/issues/browse/ZF-2532

Posted in Linux | Tagged , , , , , | 1 Comment

use bcspamblock in zend form

I want to integrate the bcspamblock and zend form, so first to do: 为了能自动防止机器人攻击,打算把bcspamblock整合到zend_form中。 1 创建element_bcSpamBlock.php文件, <?php class element_bcSpamBlock extends Zend_Form_Element_Xhtml{ /** * Default form view helper to use for rendering * @var string */ public $helper = ‘bcSpamBlock’; } … Continue reading

Posted in Computer | Tagged , , , | Leave a comment

生成UUID/GUID

php的生成办法: <?php class System { function currentTimeMillis() { list($usec, $sec) = explode(” “,microtime()); return $sec.substr($usec, 2, 3); } } class NetAddress { var $Name = ‘localhost’; var $IP = ’127.0.0.1′; function getLocalHost() // static { $address = new NetAddress(); $address->Name … Continue reading

Posted in Program | Tagged , , , , | 1 Comment

PHP的Framework

很长时间没有关注PHP,今天无意中点到javaeye.com,发现其已经改版,使用了ruby on rails框架技术,做得很好,然后又看到了还有php相关的框架,最近最近一段时间在PHP的世界里也出现了很多框架。作为php的发行公司,Zend自己也推出了一个框架,简称为ZF,目前最新的稳定版本还是0.2。觉得php的动作有点慢了,应该在php5推出后,要是能紧跟就推出几个框架系统,那对于php世界应该有非常大的推动!不过,虽然动作慢了一些,但是已经有了很多的php框架发展起来了。粗粗阅读了zf的文档后,发现框架的功能还是蛮丰富的,但是ZF目前还是有相当多的进步空间的,就是说,目前还是有一些缺点的。 一些framework的比较: http://www.mustap.com/phpzone_post_73_top-10-php-mvc-frameworks http://www.phpit.net/article/ten-different-php-frameworks/ http://www.5itag.com/viewtopic.php/177 seagull感觉像是一个大的CMS系统 ZF感觉像是一个库,或者就是pear 最后看了symfony的manual,感觉symfony相当好,不过也有缺陷,就是配置太麻烦了。 在symfony中,用Propel实现了OR映射,支持多种数据库,包括mysql,sqlserver,pgsql,sqlite,oracle。 感觉这套框架和zend framework有很大不同,对我来说,symfony要好于zf。 还支持schema, or map, paging, multitype databases, … Conclusion: 首选symfony,其次cakephp,最后再考虑zf。当然还可以考虑seagull。

Posted in Program | Tagged , , , , , | Leave a comment

php4+mysql 4.1的问题

php4+mysql 4.1的问题 以前的一个考试系统,在PHP4+MYSQL 3的环境下进行开发的。 今天转到XP的APACHE 2 + PHP 4+ MYSQL 4.1环境下居然无法使用。提示PHP4无法连接数据库。 经过GOOGLE才发现是MYSQL 4.1修改了加密算法,需要处理一下才可以: 进入mysql 然后执行, SET PASSWORD FOR ‘some_user’@’some_host’ = OLD_PASSWORD(‘newpwd’); 另外还有一个中文乱码问题: 本来用的是GB2312编码,为了扩大系统的应用范围,想改成UTF8编码。程序改好后,发现从MYSQL提出来的数据都是GB2312编码,然后mysqldump在iconv -f gb2312 -t utf8,但有的数据无法转换,经检查是图像在数据库中的存贮部分,就把那个表单独给dump出来,然后在转换剩下的部分,大功告成。

Posted in eLearn | Tagged , , | 2 Comments

php mapscript msGetLabelSize() 错误

当出现这种错误时,而直接使用shp2img可以生成图象时,请检查你的PHP中的–with-gd参数后面是否指定了具体的gd路径. Warning: MapServer Error in msGetLabelSize(): libgd was not built with FreeType font support in

Posted in MapServer | Tagged , , , | Leave a comment

debian sarge的PHP4的编译参数

debian中默认的PHP4编译参数,太长了,导致MAPSERVER的MAPSCRIPT无法编译。 ‘./configure’ ‘–prefix=/usr’ ‘–with-apxs2=/usr/bin/apxs2′ ‘–with-regex=system’ ‘–with-config-file-path=/etc/php4/apache2′ ‘–disable-rpath’ ‘–enable-memory-limit’ ‘–disable-debug’ ‘–with-layout=GNU’ ‘–with-pear=/usr/share/php’ ‘–enable-calendar’ ‘–enable-sysvsem’ ‘–enable-sysvshm’ ‘–enable-sysvmsg’ ‘–enable-track-vars’ ‘–enable-trans-sid’ ‘–enable-bcmath’ ‘–with-bz2′ ‘–enable-ctype’ ‘–with-db4′ ‘–with-iconv’ ‘–enable-exif’ ‘–enable-filepro’ ‘–enable-ftp’ ‘–with-gettext’ ‘–enable-mbstring’ ‘–with-pcre-regex=/usr’ ‘–enable-shmop’ ‘–enable-sockets’ ‘–enable-wddx’ ‘–disable-xml’ ‘–with-expat-dir=/usr’ ‘–with-xmlrpc’ ‘–enable-yp’ ‘–with-zlib’ ‘–with-pgsql’ ‘–with-kerberos=/usr’ ‘–with-openssl=/usr’ ‘–enable-dbx’ … Continue reading

Posted in Linux | Tagged , , | 1 Comment