【发布时间】:2012-11-06 04:52:12
【问题描述】:
我正在使用以下代码
echo 'Curl: ', function_exists('curl_version') ? 'Enabled' : 'Disabled';
这可以启用或禁用它
但我想作为函数说函数名称是_iscurl
然后我可以在我的网站代码中的任何位置调用它
if (_iscurl()){
echo "this is enabled"; // will do an action
}else{
echo "this is disabled"; // will do another action
}
和我之前的问题check if allow_url_fopen is enabled or not几乎一样
【问题讨论】:
-
为什么不使用
function_exists('curl_version')作为您的_iscurl()函数? -
请参阅编写
function的手册,将您的单行代码装入其中,将echo替换为return,然后将三元组去掉。
标签: php