新聞中心
我們在使用PHP語言進行實際編碼時,肯定會用上函數(shù),但是如何才能解決這個函數(shù)是夠可用的檢測呢?下面我們就具體介紹有關(guān)PHP檢查函數(shù)可用的方法技巧。#t#

我們提供的服務(wù)有:成都網(wǎng)站設(shè)計、網(wǎng)站建設(shè)、外貿(mào)網(wǎng)站建設(shè)、微信公眾號開發(fā)、網(wǎng)站優(yōu)化、網(wǎng)站認證、市南ssl等。為1000多家企事業(yè)單位解決了網(wǎng)站和推廣的問題。提供周到的售前咨詢和貼心的售后服務(wù),是有科學管理、有技術(shù)的市南網(wǎng)站制作公司
PHP檢查函數(shù)可用1. 獲取所有可用的模塊 - get_loaded_extensions
該函數(shù)返回所有已經(jīng)加載的(可用的)模塊。
用法:
print_r(get_loaded_extensions());
PHP檢查函數(shù)可用2. 獲取指定模塊的可用函數(shù) - get_extension_funcs
該函數(shù)返回指定模塊所有可用的函數(shù)。傳入的參數(shù)(模塊名稱)必須是小寫
用法:
print_r(get_extension_funcs("gd"));
PHP檢查函數(shù)可用3. 獲取所有已經(jīng)定義的函數(shù) - get_defined_functions
該函數(shù)返回所有已經(jīng)定義的函數(shù),包括內(nèi)置函數(shù)和用戶自定義函數(shù)。
用法:
- function myrow($id, $data){
- return "
\n"; $id $data - }
- $arr = get_defined_functions();
- print_r($arr);
輸出:
- Array
- (
- [internal] => Array
- (
- [0] => zend_version
- [1] => func_num_args
- [2] => func_get_arg
- [3] => func_get_args
- [4] => strlen
- [5] => strcmp
- [6] => strncmp
- ...
- [750] => bcscale
- [751] => bccomp
- )
- [user] => Array
- (
- [0] => myrow
- )
- )
其中 $arr["internal"] 是內(nèi)置函數(shù), $arr["user"] 是用戶自定義函數(shù)。
PHP檢查函數(shù)可用4. 檢查指定函數(shù)是否存在 - function_exists
該函數(shù)返回指定函數(shù)是否已經(jīng)定義。
用法:
- if (function_exists('imap_open')) {
- echo "IMAP functions are available.
\n";- } else {
- echo "IMAP functions are not available.
\n";
網(wǎng)站名稱:深入研究PHP檢查函數(shù)可用的方法
本文URL:http://www.dlmjj.cn/article/djcipop.html


咨詢
建站咨詢
