Discuz 移除 cp.discuz.qq.com

Discuz 移除 cp.discuz.qq.com

裝好了DZ,X2.5但發現官方強制使用雲平台,
對於我們台灣的用戶根本用不到,所以手動修改了一下,讓他不再使用cp.discuz.qq.com
果然讀取速度變快了!
哈哈

_core_Tips_

將舊資料導入Discuz! X2.5 中

將舊資料導入Discuz! X2.5 中

某些需求原因,開始使用DZ 2.5!
第一次使用DZ,感覺還不錯!非常佩服撰寫的團隊。
趁著轉移資料的時候,順便把舊網站的資料由MySQL4.0 更新到 MySQL5.5,
把頭痛的Big5=>UTF-8一次解決了!!
這邊筆記一下要將導入原有的主題方式。
先了解一下DZ的配置。
DZ資料表:
1.pre_forum_thread (儲存主題的資料表)
2.pre_forum_post (儲存主題及回覆的資料表)
3.pre_forum_forum (儲存討論區版塊名稱和相關設定資料表)
4.pre_forum_post_tableid (紀錄主題的資料表)

導入方式:
上面四個資料表就是我們要儲存的地方。

cookie-free域名提高網頁效率-優化網站性能(yslow)

cookie-free域名提高網頁效率-優化網站性能(yslow)

YSlow給如何提高網頁效率和優化網站性能提供了22條建議,其中有一條是關于域名的:Use cookie-free domains。
使用 cookie-free domains 有什麽好處呢?當用戶瀏覽器發送一個靜態文件,如圖片image、CSS樣式表文件時會同時發送同一個域名(或二級域名)下的cookies,但是網站服 務器對發送過來的cookies完全不予理會,因此這些沒用的cookies白白浪費了網站帶寬,影響網站加載速度和網頁性能表現。YSlow建議爲瞭解 决這個問題,就可以通過使用 cookie-free domains 的方法來做優化,從而提高網頁效率。
使用二級域名作爲cookie-free domains
通俗地說,所謂的 cookie-free domains 就是在瀏覽器發送靜態內容的請求時不會發送cookies 的域名。YSlow提示可以申請注册一個二級域名專門用來儲存這些靜態圖片、JS、靜態CSS文件。
在前面泛域名解析設置影響seo和Google PR值這裏提到了www開頭,形如www.haohtml.com的域名實際上也是屬于二級域名。如果你的網站主域名是www開頭的域名,建立一個二級域 名作爲單獨儲存(hosting)靜態圖片、JS、CSS文件的cookie-free domains 是可行的;但是如果網站主域名用的是比較短的頂級域名,如遠方博客用的是不帶www的頂級域名haohtml.com,使用新創建的二級域名作爲 cookie-free domains的方法是無效的。因爲頂級域名haohtml.com會向所有被請求的靜態文件二級域名服務器發送cookies。
即www.haohtml.com 和 blog.haohtml.com是互相獨立的兩個“二級域名”,不會造成域名污染, blog.haohtml.com 可以作爲cookie-free 域名;但是需要做一些設置,比如下面介紹的Wordpress 博客設置wp-config.php文件的實例。
頂級域名haohtml.com 會向所有被請求的二級域名(子域名:www.haohtml.com和blog.haohtml.com)發送 cookies,blog.haohtml.com 也會被污染,不能當作cookie-free 域名。具體原因在下面Wordpress 博客cookie-free domains設置中有介紹。
使用獨立域名作爲cookie-free domains
那麽使用頂級域名的博客應該如何使用 cookie-free domains?解决方法是使用另外一個獨立域名。比如雅虎Yahoo! 自身使用的是就是獨立域名ymig.com來作爲cookie-free domains的,YouTube使用的是ytimg.com 獨立域名。
現在注册一個域名也很便宜的,godaddy 域名以.com .info .org .net 後綴的域名第一年購買都很便宜,第二年續費比較貴,這時候第二年可以再換一個新的。其他一些域名注册商也差不多這樣。
WordPress 博客cookie-free domains 設置
在Wordpress 博客中,針對使用帶www域名作爲網站主域名,其他二級域名作爲cookie-free domains 的情况,還要再另外設置Cookie的作用域就可以了。打開wp-config.php文件,設置COOKIE_DOMAIN:
<php? define(‘COOKIE_DOMAIN’, ‘www.haohtml.com’); ?> 所謂的COOKIE_DOMAIN,就是cookie-free domains相反的意思。看看Wordpress 對Set Cookie Domain 的介紹:
爲Wordpress設置的COOKIES Domain 可以進行一些特殊情况下的域名設置。比如使用二級域名存放靜態內容。爲了阻止Wordpress Cookies 在對每一個二級域名上的靜態內容請求時被傳送,我們可以只設置非靜態域名爲cookie domian。
The domain set in the cookies for WordPress can be specified for those with unusual domain setups. One reason is if subdomains are used to serve static content. To prevent WordPress cookies from being sent with each request to static content on your subdomain you can set the cookie domain to your non-static domain only.
設置COOKIE_DOMAIN就可以指定哪個二級域名需要傳送cookies,其他的域名不發送cookies。所以如果我們的網站主域名用的是 頂級域名,COOKIE_DOMAIN就必須設置爲頂級域名haohtml.com了,而頂級域名的設置會映射到各個子域名,所以即使另外添加二級域名作 爲cookie-free domains 也無效了。這時只能另外注册一個獨立的頂級域名。

PHP5與PHP4的區別

PHP5與PHP4的區別

一、未100%向下兼容

在php5中儘管大部分PHP4的代碼應該不用修改就能運行,還是應該留意以下不向下兼容的改變:

有了一些新關鍵字。

strrpos() 和 strripos()如今使用整個字符串作爲 needle.

非法使用字符串偏移量會導致 E_ERROR 而不是 E_WARNING.一個非法使用的例子:$str = ‘abc’; unset($str[0]);.

array_merge() 被改成隻接受數組。如果傳遞入非數組變量,對每個此類參數都會發出一條 E_WARNING 信息。要小心因爲你的代碼有可能瘋狂發出 E_WARNING.

PATH_TRANSLATED 服務器變量在 Apache2 SAPI 中不再暗中設定,這和 PHP 4 中的情形相反,如果 Apache 沒産生此值則其被設爲和 SCRIPT_FILENAME 服務器變量一樣的值。此修改是爲了遵守CGI 規範。更多信息參考手册中 $_SERVER[‘PATH_TRANSLATED’] 的說明。此問題也影響到 PHP >= 4.3.2 的版本。

Tokenizer 擴展不再定義T_ML_COMMENT 常量。如果把 error_reporting 設爲 E_ALL,PHP 將産生一條消息。儘管 T_ML_COMMENT 從來都沒用到過,還是在 PHP 4 中定義了。在 PHP 4 和 PHP 5 中 // 和 都被解析爲 T_COMMENT 常量。但是 PHPDoc 風格的注釋 ,自 PHP 5 開始被 PHP 解析,被識別爲 T_DOC_COMMENT.

如果 variables_order 包括“S”,$_SERVER 應該帶有 argc 和 argv 被産生。如果用戶特別配製系統不創建 $_SERVER,那此變量當然就不存在了。改變的地方是不管 variables_order 怎麽設定,在 CLI 版本中 argc 和 argv 總是可用的。本來 CLI 版不是總會産生全局變量 $argc 和 $argv 的。

沒有屬性的對象不再被當成“empty”.

有些情况下類必須在使用前被定義。這僅在使用了一些 PHP 5 的新特性(例如 interfaces)的時候發生。其它情况下行爲都沒變。

get_class(),get_parent_class() 和 get_class_methods() 如今返回的類/方法名和定義時的名字一致(區分大小寫),對于依賴以前行爲(類/方法名總是返回小寫的)的老脚本可能産生問題。一個可能的解决方法是在脚本中搜索所有這些函數幷使用 strtolower()。

區分大小寫的改變也適用于魔術常量 __CLASS__,__METHOD__ 和 __FUNCTION__.其值都會嚴格按照定義時的名字返回(區分大小寫)。

ip2long() 在傳遞入一個非法 IP 作爲參數時返回 FALSE,不再是 -1.

如果有函數定義在包含文件中,則這些函數可以在主文件中使用而與是否在 return() 指令之前還是之後無關。如果文件被包含兩次,PHP 5 會發出致命錯誤,因爲函數已經被定義,而 PHP 4 不管這個。因此推薦使用 include_once() 而不要去檢查文件是否已被包含以及在包含文件中有條件返回。

include_once() 和 require_once() 在 Windows 下先將路徑規格化,因此包含 A.php 和 a.php 只會把文件包含一次。

實例: strrpos() 和 strripos() 如今用整個字符串作爲 needle

 

實例: 沒有屬性的對象不再被當成“empty”

 

實例: 有些情况下類必須在使用之前定義

 

二、CLI 和 CGI

PHP 5 中對 CLI 和 CGI 文件名作了些改變。PHP 5 中,CGI 版本被改名爲 php-cgi.exe(以前是 php.exe),現在主目錄中的是 CLI 版本(之前是 cli/php.exe)。

PHP 5 中引進了一種新模式:php-win.exe.這和 CLI 版本相同,只除了 php-win 不輸出任何內容,因此不會提供控制臺(屏幕上不會閃過“dos 窗口”)。此行爲類似 php-gtk.

PHP 5 中,CLI 版本總會産生全局變量 $argv 和 $argc 而不管 php.ini 是怎麽設的。即使將register_argc_argv設爲 off 也不影響 CLI.

參見命令行模式。

三、移植配置文件

由于 ISAPI 模塊的名字改了,從 php4xxx 改爲 php5xxx,因此需要對配置文件作些修改。CLI 和 CGI 文件名也改了。更多信息請查看相應章節。

移植 Apache 配置極其簡單。照下面的例子來檢查需要做的修改:

實例: 移植 Apache 配置文件到 PHP 5

# 將下麵這行: LoadModule php4_module /php/sapi/php4apache2.dll # 改成這一行: LoadModule php5_module /php/php5apache2.dll

如果 web 服務器是以 CGI 模式運行 PHP 的,應該注意 CGI 版本的名字從 php.exe 改爲了 php-cgi.exe.在 Apache 中,應該照這樣改:

實例: 移植 Apache 配置文件到 PHP 5,CGI 模式

# 將下麵這行: Action application/x-httpd-php “/php/php.exe” # 改成這一行: Action application/x-httpd-php “/php/php-cgi.exe”

其它的 web 服務器中,需要修改 CGI 或者 ISAPI 模塊的名字。

四、新函數

PHP 5 有了些新函數。下麵是列表:

Arrays:

array_combine() – 用一個數組作爲鍵名,另一個數組作爲值創建一個新數組

array_diff_uassoc() – 計算數組的差別,幷用用戶提供的回調函數作附加的索引檢查

array_udiff() – 用回調函數比較數據來計算數組的差別

array_udiff_assoc() – 計算數組的差別幷作附加的索引檢查。用回調函數來比較數據

array_udiff_uassoc() – 計算數組的差別幷作附加的索引檢查。數據的比較和索引檢查都用回調函數來完成

array_walk_recursive() – 對數組的每個成員遞歸使用用戶函數

array_uintersect_assoc() – 計算數組的交集幷作附加的索引檢查。用回調函數來比較數據

array_uintersect_uassoc() – 計算數組的交集幷作附加的索引檢查。數據和索引都用回調函數來比較

array_uintersect() – 計算數組的交集。用回調函數來比較數據

InterBase:

ibase_affected_rows() – 返回前一個查詢影響到的行的數目

ibase_backup() – 在服務管理器中發起一個後臺任務幷立即返回

ibase_commit_ret() – 提交一個事務但不關閉

ibase_db_info() – 請求有關數據庫的統計信息

ibase_drop_db() – 删除一個數據庫

ibase_errcode() – 返回一個錯誤代碼

ibase_free_event_handler() – 取消一個已注册的事件句柄

ibase_gen_id() – 遞增指定的發生器幷返回其新值

ibase_maintain_db() – 在數據庫服務器上執行一條維護命令

ibase_name_result() – 給結果集指定一個名字

ibase_num_params() – 返回一個準備好的查詢的參數數目

ibase_param_info() – 返回一個準備好的查詢的參數信息

ibase_restore() – 在服務管理器中發起一個還原任務幷立即返回

ibase_rollback_ret() – 回卷一筆事務幷保留事務上下文

ibase_server_info() – 請求有關數據庫服務器的統計信息

ibase_service_attach() – 連接到服務管理器

ibase_service_detach() – 從服務管理器斷開

ibase_set_event_handler() – 注册一個當事件發布時要調用的回調函數

ibase_wait_event() – 等待數據庫發布一條事件

iconv:

iconv_mime_decode() – 解碼 MIME 頭信息字段

iconv_mime_decode_headers() – 一次解碼多個 MIME 頭信息字段

iconv_mime_encode() – 壓縮 MIME 頭信息字段

iconv_strlen() – 返回字符串中的字符計數

iconv_strpos() – 在堆棧中找到第一個出現的子串位置

iconv_strrpos() – 在堆棧中找到最後一個出現的子串位置

iconv_substr() – 從字符串中取出一部分

Streams:

stream_copy_to_stream() – 把一個流的數據複製到另一個流

stream_get_line() – 根據給定的分隔符中流中讀取一行

stream_socket_accept() – 接受一個由 stream_socket_server() 建立的 socket 連接

stream_socket_client() – 打開一個 Internet 或 Unix 域的 socket 連接

stream_socket_get_name() – 獲取本地或遠程的 sockets 名字

stream_socket_recvfrom() – 從 socket 獲取數據(不管連接是否已經建立)

stream_socket_sendto() – 向 socket 發送一個消息(不管連接是否已經建立)

stream_socket_server() – 建立一個 Internet 或 Unix 域服務器的 socket

Date/Time:

idate() – 將本地進間格式化爲整數

date_sunset() – 計算所指定日期和地點的日落時間

date_sunrise() – T計算所指定日期和地點的日出時間

time_nanosleep() – 廷遲執行程若干秒和若干納秒

Strings:

str_split() – 把一個字符串分割爲數組

strpbrk() – 在一字符串中搜索給定的字符集合中的任意一個字符

substr_compare() – 以二進制的形式比較兩個字符串,從第一個字符串的 offset 開始,直到到達長度爲 length 時結束,可自定義是否大小寫敏感比較

Other:

convert_uudecode() – 解碼 uuencoded 的字符串

convert_uuencode() – 對字符串進行 uuencode

curl_copy_handle() – 複製一個 cURL 句柄及其所有參數

dba_key_split() – 把一個鍵分隔爲字符串數組

dbase_get_header_info() – 取得 dBase 數據庫的頭部信息

dbx_fetch_row() – 獲取結果集中被設置爲 DBX_RESULT_UNBUFFERED 的行

fbsql_set_password() – 修改指定用戶的密碼

file_put_contents() – 向一個文件內寫入字符串

ftp_alloc() – 爲準備上傳的文件分配空間

get_declared_interfaces() – 以數組的形式返回所有已定義的接品

get_headers() – 獲取服務器響應 HTTP 請求時的所有頭部信息

headers_list() – 返回所有已發送或準備發送響應頭部列表

http_build_query() – 生成一個已經過 URL 編碼的請求字符串

image_type_to_extension() – 根據 getimagesize(), exif_read_data(), exif_thumbnail(), exif_imagetype() 所返回的 image-type 取得文件名後綴

imagefilter() – 對圖像應用濾鏡

imap_getacl() – 獲取指定郵箱的 ACL

ldap_sasl_bind() – 使用 SASL 綁定到 LDAP 目錄

mb_list_encodings() – 以數組的形式返回所支持的全部字符集

pcntl_getpriority() – 獲得任意一個進程的優先級

pcntl_wait() – Waits on or returns the status of a forked child as defined by the waitpid() system call

pg_version() – 返回一個包含客戶端、協議和服務器版本的數組

php_check_syntax() – 檢查指定文件的語法

php_strip_whitespace() – 返回已經去除注釋和空白的源代碼

proc_nice() – 修改當前進程的優前級

pspell_config_data_dir() – 修改語言文件的位置

pspell_config_dict_dir() – 修改主要單詞列表的位置

setrawcookie() – 發送一個沒有經過 url 編碼的 cookie 值

scandir() – 列中指定目錄中的所有子目錄和文件

snmp_read_mib() – 在一個可用的 MIB 樹中讀取和分板一個 MIB 文件

sqlite_fetch_column_types() – 以數組的形式返回一張表中的列類型

注意: Tidy 擴展庫的 API 也作了重大調整

五、新指令

PHP 5 在 php.ini 中引進了一些新指令。列表如下:

mail.force_extra_parameters – 强制指定的參數附加值作爲額外的參數傳遞給 sendmail 庫。這些參數總是會替換掉 mail() 的第 5 個參數,即使在安全模式下

register_long_arrays – 允許/禁止 PHP 注册已過時的 $HTTP_*_VARS 變量

session.hash_function – 選擇一種散列函數(MD5 或 SHA-1)

session.hash_bits_per_character – 定義將二進制散列數據轉換爲可讀格式時每個字符中儲存幾個位(從 4 到 6)

zend.ze1_compatibility_mode – 啓用 Zend Engline 1 代(PHP 4)兼容模式

六、數據庫

關于數據庫(MySQL 和 SQLite)在 PHP 5 中有些改變。

PHP 5 中不再綁定 MySQL 客戶端連接庫,因爲授權和一些其它問題。

有個新擴展庫 MySQLi(改良版 MySQL),設計用來工作于 MySQL 4.1 及更高版本之下。

自 PHP 5 起,SQLite 擴展庫內置在 PHP 中。SQLite 是一個可嵌入 SQL 數據庫引擎,不是客戶端連接庫用來連接大型數據庫服務器(如 MySQL 或 PostgreSQL)的。SQLite 庫直接讀寫磁盤上的數據庫文件。

七、新對象模型

PHP 5 中有個新對象模型(Object Model)。PHP處理對象的方式完全重寫了,允許更佳性能和更多特性。之前版本的 PHP,對象處理方式和原始類型(例如整型和字符串)相同。此方法的缺點是當變量被賦值或作爲參數傳遞給方法時語義上整個對象都被拷貝。在新方法中,對象通過句柄引用,而不是值(可以將句柄當成是對象的標識符)。

很***a href=.itwis.com/html/php’>PHP程序員根本沒意識到舊的對象模型的這種拷貝怪癖,因此大多數PHP應用程序拿來就能運行,或者只做很小的修改。

新對象模型的文檔見“類與對象”.

========================

Difference with  PHP5 and PHP4

One , not 100% backwards compatible

Although most of the php5 in PHP4 code should be able to run without modification , or should be aware of the following changes are not backward compatible :

With some new keywords.

strrpos () and strripos () now use the entire string as a needle.

Illegal use of string offsets causes E_ERROR instead of E_WARNING example of an illegal use : $ str = ‘abc’; unset ($ str [0]);..

array_merge () was changed to accept only arrays. If passed into non- array variable , issue a E_WARNING message for each of these parameters are . Be careful because your code may be issued crazy E_WARNING.

PATH_TRANSLATED server variable in Apache2 SAPI is no longer secretly set , and PHP 4 in this case the contrary, if Apache does not produce this value then the SCRIPT_FILENAME server variable is set and the same value . This change was made to comply with the CGI specification. For more information reference manual $ _SERVER [‘PATH_TRANSLATED’] description . This problem also affects PHP> = version 4.3.2 .

Tokenizer extension is no longer defined T_ML_COMMENT constant. If error_reporting set to E_ALL, PHP will generate a message. Although T_ML_COMMENT never used before, or defined in PHP 4 it. In PHP 4 and PHP 5 / / and are resolved to T_COMMENT constant. But PHPDoc style comments , starting PHP 5 are parsed by PHP , are identified as T_DOC_COMMENT.

If variables_order including “S”, $ _SERVER should be generated with argc and argv . If the user does not create a system specially formulated $ _SERVER, then of course it would not exist. Variables_order change is that no matter how local settings, CLI version argc and argv are always available. CLI version will always produce the global variables $ argc and $ argv ‘s .

Object with no properties is no longer considered “empty”.

In some cases classes must be defined before use. It is only in use for some of the new features of PHP 5 ( such as interfaces) occurs when . Other circumstances have not changed behavior .

get_class (), get_parent_class () and get_class_methods () now returns the class name and the name of the method of definition / agreement ( case-sensitive ) , rely on the previous behavior ( class / method name always returns lowercase ) old scripts may cause problems . One possible solution is to search all of these functions in the script Bing use strtolower ().

Case-sensitive change also applies to the magic constant __CLASS__, __METHOD__ and __FUNCTION__. Whose values ​​are in strict accordance with the definition of the name returned ( case-sensitive ) .

ip2long () when passed into an illegal IP as an argument returns FALSE, instead of -1 .

If there are functions defined in the included file, regardless of whether these functions can be irrelevant before or after return () instruction in the main file . If the file is included twice , PHP 5 issues fatal error because functions were already declared , while PHP 4 does this . Therefore recommended to use include_once () instead of going to check whether the file was already included and conditionally return inside the included file.

include_once () and require_once () in the Windows path first standardized, and therefore contains A.php and a.php the file contains only once .

Examples : strrpos () and strripos () now use the entire string as a needle

 

Example: object with no properties is no longer considered “empty”

 

Example: In some cases classes must be defined before use

 

Two , CLI and CGI

PHP 5, the CLI and CGI files masterpieces for some change. In PHP 5 , CGI version was renamed to php-cgi.exe ( previously php.exe), now home directory is the CLI version (previously cli / php.exe).

PHP 5 introduced a new model in : php-win.exe This CLI version of the same , except that php-win does not output anything , it does not provide console ( not flashed “dos window ” on the screen ) . This behavior is similar to php-gtk.

In PHP 5 , CLI version will always produce the global variable $ argv and $ argc regardless of how the set of php.ini . Even if register_argc_argv set off does not affect the CLI.

See the command line mode.

Third, the transplant profile

Since the ISAPI module to change the name from php4xxx to php5xxx, and therefore need to make some changes to the configuration file . CLI and CGI filenames have changed. For more information , please see the appropriate section.

Porting Apache configuration is extremely simple. See the example below to check needs to be done to modify :

Example: Transplant Apache configuration file to PHP 5

# The following line : LoadModule php4_module / php/sapi/php4apache2.dll # change this line : LoadModule php5_module / php/php5apache2.dll

If the web server is running PHP in CGI mode , you should pay attention to the CGI version of the name from php.exe to php-cgi.exe in Apache , you should change as such :

Example: Transplant Apache configuration file to PHP 5, CGI mode

# The following line : Action application / x-httpd-php “/ php / php.exe” # change this line : Action application / x-httpd-php “/ php / php-cgi.exe”

Other web servers , the need to modify the CGI or ISAPI module name .

Fourth, the new function

PHP 5 has some new functions. Here is a list :

Arrays:

array_combine () – with an array as keys , another array as the value of creating a new array

() array_diff_uassoc – the difference between an array of computing , Bing additional index check with the user-supplied callback function

() array_udiff – the difference between using a callback function to calculate the array comparative data

array_udiff_assoc () – Computes the difference of arrays with additional index check Bing . Using a callback function to compare the data

array_udiff_uassoc () – Computes the difference of arrays with additional index check Bing . Comparison of the data and index checks are done using a callback function

array_walk_recursive () – for each member of the array using a user function recursively

array_uintersect_assoc () – the intersection of arrays with additional index of Bing checks . Using a callback function to compare the data

array_uintersect_uassoc () – the intersection of arrays with additional index of Bing checks . Data and indexes are compared by using a callback function

array_uintersect () – to calculate the intersection of arrays . Using a callback function to compare the data

InterBase:

The number before returning a query affected rows – ibase_affected_rows ()

ibase_backup () – initiate a background task in the service manager immediately returned Bing

ibase_commit_ret () – commits a transaction without closing

ibase_db_info () – Request statistics about a database

ibase_drop_db () – delete a database

ibase_errcode () – returns an error code

ibase_free_event_handler () – Cancels a registered event handler

ibase_gen_id () – increments specified generator Bing returns its new value

ibase_maintain_db () – on the database server to perform a maintenance command

ibase_name_result () – assign a name to a result set

ibase_num_params () – Returns the number of parameters in a prepared query

ibase_param_info () – Returns a prepared query parameter information

ibase_restore () – initiate a restore task in the service manager immediately returned Bing

ibase_rollback_ret ​​() – Rewind the context of a transaction Bing reserved Affairs

ibase_server_info () – Request statistics about a database server

ibase_service_attach () – connect to the service manager

ibase_service_detach () – Disconnect from the service manager

ibase_set_event_handler () – Register a callback function to be called when the event is published

ibase_wait_event () – Wait for the database publishing an event

iconv:

iconv_mime_decode () – decode MIME header field

iconv_mime_decode_headers () – once decode multiple MIME header field

iconv_mime_encode () – Compression MIME header field

iconv_strlen () – Returns the string character count

iconv_strpos () – find the first occurrence of the substring position in the stack

iconv_strrpos () – find the position of the last occurrence of a substring in the stack

iconv_substr () – Remove a portion from a string

Streams:

stream_copy_to_stream () – Copy data from one stream to another stream

stream_get_line () – read a line of a given flow in the separator

stream_socket_accept () – accepts consisting stream_socket_server () establish a socket connection

stream_socket_client () – Open an Internet connection or socket Unix domain

stream_socket_get_name () – Get the name of a local or remote sockets

stream_socket_recvfrom () – retrieve data from socket ( regardless of whether the connection has been established )

stream_socket_sendto () – Send a message to the socket ( regardless of whether the connection has been established )

stream_socket_server () – to establish an Internet or Unix domain server socket

Date / Time:

idate () – Format a local into an integer between

date_sunset () – to calculate the date and place specified in the Sunset

date_sunrise () – T is calculated by a specified date and place of the sunrise time

time_nanosleep () – Several Ting Chi Cheng seconds and perform a number of nanoseconds

Strings:

str_split () – put a string into an array

strpbrk () – in a search string in a given character set of any one character

substr_compare () – in binary form to compare two strings , the first string from offset start until the end when it reaches a length of length , you can customize whether the comparison is case sensitive

Other:

convert_uudecode () – decoding uuencoded string

convert_uuencode () – uuencode strings

curl_copy_handle () – Copy a cURL handle all its parameters

dba_key_split () – put a delimited string array

dbase_get_header_info () – get the header information dBase database

dbx_fetch_row () – Get the result set rows are set to DBX_RESULT_UNBUFFERED

fbsql_set_password () – modify the specified user’s password

file_put_contents () – write a string to a file

ftp_alloc () – allocate space for files uploaded to prepare

get_declared_interfaces () – Returns an array of all defined access products

get_headers () – get the server to respond to all HTTP request headers when

headers_list () – Returns a list of all the response has been sent or is ready to send the head

http_build_query () – has been generating a URL -encoded query string

image_type_to_extension () – According to getimagesize (), exif_read_data (), exif_thumbnail (), exif_imagetype () which returns the image-type get filename suffix

imagefilter () – apply a filter to the image

imap_getacl () – Gets the specified mailbox ACL

ldap_sasl_bind () – Bind to LDAP directory using SASL

mb_list_encodings () – Returns an array of all character sets are supported

pcntl_getpriority () – get any priority of a process

pcntl_wait () – Waits on or returns the status of a forked child as defined by the waitpid () system call

pg_version () – Returns an array of client and server versions of the agreement included

syntax check of the specified file – php_check_syntax ()

php_strip_whitespace () – Returns comment has been removed and a blank source code

proc_nice () – modify the current process of gifted pre-

Location modify the language file – () pspell_config_data_dir

modify the position of the main word list – () pspell_config_dict_dir

setrawcookie () – Send a cookie without url encoded value

scandir () – column specified directories and files in all subdirectories

snmp_read_mib () – available in a MIB tree, and the scoreboard read a MIB file

sqlite_fetch_column_types () – Returns an array of the type of a table column

Note : Tidy extension repository API also made significant adjustments

Fifth, the new directive

PHP 5 introduced some new directive in php.ini . List is as follows :

mail.force_extra_parameters – Forced specified parameters passed to sendmail library added as an additional parameter. These parameters will always replace the mail () in the first five parameters , even in safe mode

register_long_arrays – enable / disable PHP registered obsolete variable $ HTTP_ * _VARS

session.hash_function – Select a hash function (MD5 or SHA-1)

session.hash_bits_per_character – define each character will be stored in several binary bit hash data into a readable format ( from 4-6 )

zend.ze1_compatibility_mode – Enable Zend Engline 1 generations (PHP 4) compatibility mode

Sixth, the database

About Database (MySQL and SQLite) some changes in PHP 5 .

PHP 5 no longer bundles MySQL client library , as authorized , and some other problems.

There under in MySQL 4.1 and later new extensions MySQLi ( improved version of MySQL), is designed to work one .

Since PHP 5 , SQLite extensions built- in PHP. SQLite is an embeddable SQL database engine , not a client library used to connect to a large database server ( such as MySQL or PostgreSQL) ‘s . SQLite library to read and write directly to the database files on disk.

Seven new object model

There is a new PHP 5 object model (Object Model). PHP way of handling objects completely rewritten , allowing for better performance and more features . Prior versions of PHP, objects were handled like primitive types ( such as integers and strings ) the same . The disadvantage of this method is that when a variable is assigned or as the whole object parameter passed to the method are copy semantics. In the new method, the object referenced by the handle , not the value ( as is the identifier can handle objects ) .

It *** a href = .itwis.com / html / php ‘> PHP programmer did not realize this copy quirks old object model, so most will be able to run PHP applications used , or only very minor modifications .

See the document ” object class ” new object model.

透過 GTmetrix 檢測網頁讀取速度

透過 GTmetrix 檢測網頁讀取速度

猶記得十年前做網頁時用的FrontPage,讓網頁HTML亂七八糟!而初次做網頁只追求結果不求效率.
如今網頁開啟的速率從0.02~0.09 我都會計較,現在回想起來還滿好笑的.
推薦可以用 GTmetrix 來檢測你網頁開啟的速度,這網站很強大,還會給你最佳化建議.

http://gtmetrix.com/ 連結進去後應該就不用作操作教學了吧 我想?

關鍵在最後的結果分析!
Page Speed
1. Specify image dimensions 指定圖像大小
img的標籤裡面指定圖片大小 (width & height)
會讓瀏覽器解析的較快
此外,不需要半透明的圖,用jpg或gif會比png的檔案小很多!

2. Leverage browser caching 瀏覽器暫存
不常變動的檔案讓使用者暫存在本機,可以加快速度

3. Enable gzip compression 使用gzip壓縮js和css檔案

4. Defer parsing of JavaScript 延後javascript的載入
在網頁末端再載入js,可以讓網頁先出現,節省等待js的時間

5. Minify CSS 最小化css檔案
利用軟體可以移除css中的斷行、不必要的空白等可以使檔案更精簡

Yslow
1. Add Expires headers 在靜態檔案中指定暫存時間
和Page Speed的 2 一樣目的

2. Compress components with gzip 使用gzip壓縮js和css檔案

3. Use a Content Delivery Network (CDN) 使用CDN
例如jQuery和jQueryUI 可以利用google提供的CDN讀取

4. Make fewer HTTP requests 減少伺服器要求
利用軟體將多個js合併成一個檔案,css也一樣

後記
通常把你分數較低的檢測項目拿去GOOGLE就會有答案,我就不寫教學了:P
最讓我搞不定的就是「Optimize images」 因為網站常會有網友上傳圖片,圖片是自動新增的,無法人為控管,
而目前找不到最好的linux 最佳化圖片模組, 只好加減用沒這麼棒的了.

下面轉錄網上找到的相關筆記:
「GTmetrix」在首頁開宗明義的說,當你的網頁載入超過4秒鐘的話,將會有很多用戶因此離開你的網站。Google不久前也清楚明白的提到,「網頁速度」是Google搜尋排序的參考指標之一,或許所佔比重不大,但確實已經納入參考。而「GTmetrix」則是一個網站效能分析服務,提供免費的測試與建議工具,指出我們應該如何去優化網頁速度的可行作法。

之前類似的網頁速度免費測量工具,比較知名的有「Pingdom Tools」;不過相較之下,「GTmetrix」在免費、不需註冊的前提中,提供了更豐富的測量結果與「具體的分析建議」;GTmetrix不僅可以讓你觀察網頁中每個元素的載入速度,更重要的是會根據網站目前的效能缺陷,提供實際的網站優化建議,例如會直接告訴你應該延後JavaScript載入、應該壓縮圖檔等等。

對於網站、部落格經營者來說,免費、不需註冊登入但又功能豐富的「GTmetrix」,是用來檢測網站速度優化成果的好工具。
內建Google、Yahoo推出的網站效能分析工具:
來到GTmetrix,你只要在網頁中間的輸入欄位,填上你的網站網址,按下〔Go!〕,就可以開始分析自己的網頁載入速度。

這邊GTmetrix使用了兩個知名的工具幫你檢測,一個是Yahoo的YSlow,一個是Google的Page Speed,現在你不用自己額外安裝這兩款測試工具,直接利用GTmetrix,就能獲得Google、Yahoo兩大搜尋引擎所提供的網站效能檢測成果。

前面有提到,網頁速度也是搜尋引擎排序的指標,所以觀察Google和Yahoo如何測試你的網站效能,當然是優化網站非常重要的一環。

簡單易懂的網站效能指標評等:
開始測試分析後,等待一小段時間就能看到檢測結果,首先你可以在「Summary(摘要)」中,看到兩個總評分數,分別代表透過Yahoo YSlow和Google Page Speed分析後獲得的評等。

這裡的等級制度,是透過許多分項指標綜合評比後獲得的,當然「A」級是最好的結果。
拉到分析網頁的下方,就可以看到網站在每個分項指標中獲得的個別分數(評等),你可以透過標籤分頁查看「YSlow」和「Page Speed」提供的不同評比。

這邊GTmetrix會把網站最需要優化的項目排列在清單的最前面,讓你直接看到應該針對哪些項目對症下藥。而你也可以透過這裡提供的分項指標,去了解優化網站應該顧及的各種層面。

你可以打開每個分項指標,就可以看到更詳細的相關內容,GTmetrix也透過「what does this mean?」提供了每個分項指標的意義說明。我覺得GTmetrix除了是一個好用的網站效能分析工具外,也可以當做一個優化網站的學習教科書來使用。
測試網頁元素的個別載入速度:
在測試結果中切換到〔Timeline〕分頁,可以看到類似Pingdom所提供的「個別網頁元素載入速度」,你可以從清單中,很清楚的看到哪些元素佔用了最多的載入時間,從而你可以決定應該優化哪個部分。

多組網站對比測試:
最後,你還可以在單一網站測試分析結果的左方,點選「Compare to another URL」,輸入另外一個網站的網址,就可以透過GTmetrix比較兩個網站在各種層面的效能評比。
老牌、免費、不需登入的「Pingdom Tools」,提供的是很直覺的網頁速度測量工具,顯示每個網頁元素的載入時間,讓你知道哪些元件拖慢了網頁速度。

但是「GTmetrix」則更進一步,它不僅僅是一個免費、不需登入的測量工具,而且還具備了分析、建議功能。利用Google Page Speed、Yahoo YSlow這兩大工具的指標評等,GTmetrix能夠從「如何優化」的角度,讓你不只知道哪個元件比較慢,更可以知道應該怎麼去修改。推薦給想要優化網站的朋友試用看看(註冊GTmetrix帳戶後,則可以記錄每次的評比測量結果)。