こんにちは、php ファイル内に外部の .php ファイルを含めたいと思います。
この .php ファイルには、ページ内で必要な変数宣言が含まれています。
file_get_contents を使用してみましたが、内部の行をエコーするだけです。
試した:
function getter($url) {
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HEADER, 0);
$data = curl_exec($ch);
curl_close($ch);
return $data;
}
echo getter('www.somehting.com/phpfile.php');
-まだ動作していません
も試しました:
$code = file_get_contents($url);
eval($code);
config.iniを変更せずにこれを行う方法はありますか?
ファイルを含める必要があるページの .htaccess にアクセスできます。
ファイルは別のサーバー「ラックスペース」にあります。
ありがとうございました。