2011-06-14 104 views
4

我正在升級PHP代碼庫以便能夠在PHP5.3 +上運行,我需要一個使用包裝器的函數列表。使用包裝器的PHP函數

http://www.php.net/manual/en/wrappers.php

此頁面提及; fopen(),copy(),file_exists()和filesize()。我知道有一個事實,即有其他的功能; file_get_contents(),file()等。

有沒有人有完整的清單?或者也許是一種簡單的方式來通過目錄「grep」來使用包裝器來查找函數?

+0

@ninuhadida - 名單很可能會相當長。我可以想到「include」,「require」,「require_once」,「include_once」,「readfile」,「file」,「virtual」,「imagecreatefrom ...」,「DomDocument :: loadXMLFile」,「 Dom :: Document :: loadHTMLFile「等。所以許多函數依賴於文件名/ url的使用。 **這裏真正的問題是爲什麼你想要一個完整的列表** – 2011-06-14 15:34:33

+0

創建這樣的列表幾乎是不可能的,因爲幾乎每個支持文件名的函數/方法都支持流封裝,包括擴展中的那些。你不能使用包裝器對所有函數「grep」,因爲這些URL可能是表達式或變量的結果。你可以做的最好的辦法是對目錄中的所有URL進行grep處理。 – netcoder 2011-06-14 15:42:42

+0

@Francois - 一些包裝已經改變了功能,例如。/dev/stdin需要更改爲php:// stdin。只要我有一個函數列表,我可以用grep和其他工具處理它。 – 2011-06-14 15:43:33

回答

3

grep php來源爲php_stream_open_wrapper_ex調用,這應該給PHP_FUNCTION s直接與包裝進行交互。

粗糙,可能有部分錯誤列表(-B 100不準確):

$ find . -name '*.c'| xargs grep -B 100 php_stream_open_wrapper_ex| grep PHP_FUNCTION 
./ext/standard/url.c-PHP_FUNCTION(rawurlencode) 
./ext/standard/url.c-PHP_FUNCTION(rawurldecode) 
./ext/standard/url.c-PHP_FUNCTION(get_headers) 
./ext/standard/file.c-PHP_FUNCTION(file_get_contents) 
./ext/standard/file.c-PHP_FUNCTION(file_put_contents) 
./ext/standard/file.c-PHP_FUNCTION(file) 
./ext/standard/file.c-PHP_FUNCTION(tempnam) 
./ext/standard/file.c-PHP_FUNCTION(mkdir) 
./ext/standard/file.c-PHP_FUNCTION(rmdir) 
./ext/standard/file.c-PHP_FUNCTION(readfile) 
./ext/oci8/oci8_interface.c-PHP_FUNCTION(oci_lob_export) 
./ext/hash/hash.c-PHP_FUNCTION(hash) 
./ext/hash/hash.c-PHP_FUNCTION(hash_file) 
./ext/hash/hash.c-PHP_FUNCTION(hash_update) 
./ext/hash/hash.c-PHP_FUNCTION(hash_update_stream) 
./ext/hash/hash.c-PHP_FUNCTION(hash_update_file)