主要是因為之前用Yii 的 Widget 用的挺開心的( 除了他會每次都進一次Cycle 外) 因為用ZF沒找到有這方面相關的資訊 所以自已動手刻….. 1. 在application 下建 Titan/Base 的資料夾 ( Titan 是我想把自已寫的東西盡可能的都收在這 ) 2. vim Titan/Base/Widget.php [sourcecode language='php'] < ?php abstract class Titan_Base_Widget { protected $_basePath; protected $_viewBasePath; protected $_viewScriptPath; public function __construct( $array = null ) { //assign variables $this->_basePath = APPLICATION_PATH . DS . ‘widgets’; $this->_viewBasePath = APPLICATION_PATH . [...]
system() The system() call also tries to automatically flush the web server’s output buffer after each line of output if PHP is running as a server module. exec() 則不會flush 遇到的問題是 我的php 透過perl 去執行一些功能 然後perl 回傳 success or false 字串 在standard output 上 php再去get 這個字串 success 則print success 給 ajax 來判斷 結果 在前端的ajax 一直印出 successsuccess 的字眼 [...]
這個問題在在Zend Framework 中 Zend/Db/Statement.php 裡面 [cc lang="php" tab_size="2" lines="40"] protected function _stripQuoted($sql) { // get the character for delimited id quotes, // this is usually ” but in MySQL is ` $d = $this->_adapter->quoteIdentifier(‘a’); $d = $d[0]; // get the value used as an escaped delimited id quote, // e.g. \” or “” or \` [...]
1.VIM 的部份 在你的vim 下 :version 看看有沒有+python 和+sign 沒的話…. 把vim 重裝… #make install WITH_PYTHON 這樣應該就會有了… 2.安裝Script 去這個地方抓 http://www.vim.org/scripts/script.php?script_id=1929 放到/usr/local/share/vim/vim71/plugin/底下… 3.安裝xdebug #cd /usr/ports/devel/php-xdebug #make install #vim /usr/local/etc/php.ini [sourcecode language='text'] [Zend] zend_extension = /full/path/to/xdebug.so xdebug.remote_enable = 1 xdebug.remote_port = 9000 xdebug.remote_host = localhost [/sourcecode] 加入上面這幾行.. 看一下phpinfo 有沒有出現xdebug 4. 然後開browser run你的url 後面的?XDEBUG_SESSION_START=1 這是重點.. 例如 http://example.com/index.php?XDEBUG_SESSION_START=1 5. #vim xxx.php 然後按F5 [...]
之前忘了在那看到這個 PHP Universal Feed Generator 感覺還滿好用的… 結果就在這幾天要用的時後… 發現他中文在轉碼的時後有問題… trace 一下他的code 發現是298 行的 htmlentities($tagContent);這個的問題 把他換成 htmlentities($tagContent, ENT_COMPAT, ‘utf-8′); 應該就可以了 另外看了一下他在header 的部份沒有宣告是UTF8 所以我也修改了一下…. 在84 行 header(“Content-type: text/xml”); 改一下 header(“Content-type: text/xml; charset=UTF-8″); 基本上這樣應該就可以了…
記得先compile calendar 這個php extension 才會有 gregoriantojd 這個function.. http://roshanbh.com.np/2008/03/finding-days-difference-php.html PS 之前都是自已硬幹….. 用mktime date轉來轉去才算出來的…
看起來似乎是php5.2.5的bug……………… http://bugs.php.net/bug.php?id=43295 以前都覺得怎麼會有人踩到地雷 想說怎麼可以這麼倒霉 沒想到我也會踩到…. 目前就先downgrade 看起來就沒這個情況了 。