Recently in PHP 技術 Category

自動偵測文字URL並轉成Hyperlink

| No Comments | No TrackBacks
echo preg_replace("/(http:\/\/|www|[a-zA-Z0-9-]+\.|[a-zA-Z0-9\.-]+@)(([a-zA-Z0-9-][a-zA-Z0-9-]+\.)+[a-zA-Z0-9-\.\/\_\?\%\#\&\=\;\~\!\(\)]+)/","<a href=\"\\1\\2\" target=\"_blank\">\\1\\2</a>",$text);

PHP 大師談PHP

| No Comments | No TrackBacks
以下是轉載自kiang 兄在 http://twpug.net/modules/newbb/viewtopic.php?post_id=13851#forumpost13851 的摘要...

演講所使用的投影片:
http://talks.php.net/show/ntu

摘要:
1. FrontController 的概念很沒有效率,不如個別模組或元件使用自己需要的函式庫獨立執行。
2. PHP 5.3 在效能上有些改進,只是如果系統使用了 APC 之類的中間碼編譯軟體,效果就會變得不明顯。
3. 隱藏錯誤訊息並不代表沒有錯誤,系統依然會花費一些資源處理與記錄,所以盡可能避免程式發生錯誤或是需要嘗試猜測不確定的資訊
4. 系統效能可以透過逐層檢視方式來釐清效能瓶頸,從系統指令( strace )、C 層級操作( valgrind )到 PHP 層級操作( XDebug )
5. 變動不大的內容盡可能使用靜態內容,而不需要每次透過函式或方法產生
6. 盡可能避免程式有 XSS 漏洞,只要能夠執行 javascript ,惡意操作者就可以改變畫面中的任何元素。
7. 系統安全性問題可以關注下面網站:http://sla.ckers.org/forum/list.php?3

CI PHPMYDATAGRID

| No Comments | No TrackBacks
看到phpMyDataGrid, 覺得好玩, 就把它整合進CI裡。

只要在 phpmydatagrid.class.php 加入以下這段就行了。

PHP5
===

Function __construct(){
   $CI =& get_instance();
   $this->connectionHandler = $CI->db->conn_id;
}


PHP4
===

Function datagrid(){
   $CI =& get_instance();
   $this->connectionHandler = $CI->db->conn_id;
}

About this Archive

This page is an archive of recent entries in the PHP 技術 category.

iPhone 程式開發 is the previous category.

Find recent content on the main index or look in the archives to find all content.