28

次のコードを使用しています

echo 'file_get_contents : ', ini_get('allow_url_fopen') ? 'Enabled' : 'Disabled';

これにより、有効または無効にすることができます

しかし、私は関数として関数名を言うようにしたいと思います_isgetcontents

次に、ウェブサイトのコードのどこでも次のように呼び出すことができます

if (_isgetcontents()){
  echo "this is enabled"; // will do an action
}else{
  echo "this is disabled"; // will do another action
}
4

2 に答える 2

70

ini_get()特定の構成パラメーターの値を取得するために使用します。

if( ini_get('allow_url_fopen') ) {
   // lucky me...
} 
于 2012-11-17T18:51:16.077 に答える