중복 가능성 :
PHP로 함수 작성
다음 코드를 사용하고 있습니다.
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
}
allow_url_fopen이 활성화되었는지 여부를 확인하는 이전 질문과 거의 동일합니다.
답변
답변
<?php
// Script to test if the CURL extension is installed on this server
// Define function to test
function _is_curl_installed() {
if (in_array ('curl', get_loaded_extensions())) {
return true;
}
else {
return false;
}
}
// Ouput text to user based on test
if (_is_curl_installed()) {
echo "cURL is <span style=\"color:blue\">installed</span> on this server";
} else {
echo "cURL is NOT <span style=\"color:red\">installed</span> on this server";
}
?>
또는 간단한 것-
<?
phpinfo();
?>
curl을 검색하십시오.
출처-http: //www.mattsbits.co.uk/item-164.html
답변
var_dump(extension_loaded('curl'));
답변
이 코드를 php 파일에 넣어 확인할 수 있습니다.
<?php
if(in_array ('curl', get_loaded_extensions())) {
echo "CURL is available on your web server";
}
else{
echo "CURL is not available on your web server";
}
또는
var_dump(extension_loaded('curl'));
답변
도움이 되었기를 바랍니다.
<?php
function _iscurl() {
return function_exists('curl_version');
}
?>
답변
언제든지 새 페이지를 만들고 phpinfo()
. curl 섹션까지 아래로 스크롤하여 활성화되었는지 확인합니다.
답변
확장이로드되었는지 여부를 반환하는 프로젝트에서 재사용 가능한 일반 함수를 사용하는 것이 항상 좋습니다. 다음 기능을 사용하여 확인할 수 있습니다.
function isExtensionLoaded($extension_name){
return extension_loaded($extension_name);
}
용법
echo isExtensionLoaded('curl');
echo isExtensionLoaded('gd');
