How to check if curl is enabled or disabled

前端 未结 7 1491
孤城傲影
孤城傲影 2020-11-27 04:07

Possible Duplicate:
Writing a function in php

I\'m using the following code

echo \'Curl: \',          


        
7条回答
  •  时光说笑
    2020-11-27 04:30

    Its always better to go for a generic reusable function in your project which returns whether the extension loaded. You can use the following function to check -

    function isExtensionLoaded($extension_name){
        return extension_loaded($extension_name);
    }
    

    Usage

    echo isExtensionLoaded('curl');
    echo isExtensionLoaded('gd');
    

提交回复
热议问题