반응형
컬이 활성화 또는 비활성화되었는지 확인하는 방법
중복 가능성 :
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이 활성화되었는지 여부를 확인하는 이전 질문과 거의 동일합니다.
function _isCurl(){
return function_exists('curl_version');
}
<?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
function _iscurl() {
return function_exists('curl_version');
}
?>
언제든지 새 페이지를 만들고 phpinfo()
. curl 섹션까지 아래로 스크롤하여 활성화되었는지 확인합니다.
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');
you can check by putting these code in php file.
<?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";
}
OR
var_dump(extension_loaded('curl'));
참고URL : https://stackoverflow.com/questions/13433946/how-to-check-if-curl-is-enabled-or-disabled
반응형
'IT TIP' 카테고리의 다른 글
Swift 3 GCD API 변경 후 dispatch_once (0) | 2020.10.17 |
---|---|
서버에 업로드하기 전에 iOS에서 이미지를 압축 / 크기 조정하는 방법은 무엇입니까? (0) | 2020.10.17 |
MSTest 배포 항목은 프로젝트 테스트 설정 파일에있는 경우에만 작동합니까? (0) | 2020.10.17 |
Laravel 컨트롤러 하위 폴더 라우팅 (0) | 2020.10.17 |
Docker-Compose는 Docker 데몬에 연결할 수 없습니다. (0) | 2020.10.17 |