以前分析过 Zend Framework 1.0 的 Zend_Loader;php 内建函数 is_readable 本质上就是调用 filestat.c 的 php_stat 函数,这个在前几天关于 file_exists 和 is_file 的那个 post 中有说过。
今天在群上跟番茄吹水,说起来这个东西。于是又混一篇小记随便吹吹。
以下所有内容,45%是吹水,45%是猜测,10%是从代码中看出来的。 (more…)
November 21, 2008
September 23, 2008
Zend_Loader::isReadable 和 is_readable 的区别
September 16, 2008
为什么“is_file比file_exists快N倍”
首先,写本文的原因是看到番茄的这个 post:http://www.tblog.com.cn/archives/675
我没有重新测试,对于番茄的测试,我觉得绝对靠谱。
But why?
于是打开 php 的代码寻找到了 is_file 和 file_exists 的实现。其实原因简单到让人无法相信! (more…)
July 3, 2008
PHP —— 为什么不要在 foreach 中使用变量引用
最近在浏览同事之前写的代码的时候,发现大量的变量引用使用在 foreach 中:
1 <?php
2 $a = array( ‘a‘, ‘b‘, ‘c‘, ‘d‘);
3 foreach($a as &$v) {
4 $v = $v . ‘_bar‘;
5 }
6 var_dump($a);
April 15, 2008
發現一個比較好用的編輯器 - tsWebEditor
在公司還是要用 windows 的。于是 windows 下的 php 調試成為了一個麻煩。
在 xdebug 的文檔中看到了這個開源的編輯器,安裝試用了一下,感覺不錯。
調試起來比 notepad ++ 穩定,界面也有好許多。調試 php 不需要任何配置,連插件都不用裝。setup 之后直接打開要調試的文件,然后點需要斷點的行的行編號。在 firefox 里打開 xdebug session 插件,刷新頁面。就 OK 了。真是夠傻瓜化的。
March 18, 2008
Zend Framework 1.5 正式版 3.17 發布
今天才知道這個消息,1.5 做了很多改動,包括路由部分的大小寫解析方式也同以前 1.0x 不同。新功能對于只用 Zend Framework 開發普通網站的人來說并不是十分要緊。Zend_Form 和 Zend_Layout 反而會增加頁面編輯的難度。
* New Zend_Form component with support for AJAX-enabled form elements
* New action and view helpers for automating and facilitating AJAX requests and
alternate response formats
* LDAP, Infocard, and OpenID authentication adapters
* Support for complex Lucene searches, including fuzzy, date-range, and wildcard
queries
* Support for Lucene 2.1 index file format
* Partial, Placeholder, Action, and Header view helpers for advanced view
composition and rendering
* New Zend_Layout component for automating and facilitating site layouts
* UTF-8 support for PDF documents
對于我來說修復 bug 比新功能更讓人鼓舞:
http://framework.zend.com/issues/secure/IssueNavigator.jspa?mode=hide&requestId=10661
我查了一下,我之前提交的多數 bug 都已經修復了。
ninny project 在實際使用中發現了很多之前設計考慮不周的地方,我準備徹底重寫。 在可能的情況下會放到 code.google.com 上去。