我有一个包含凭证信息连接到APIrequire_once同一个文件多次?
我有2个不同的文件
在第一个调用的函数在2个功能我的配置文件中的配置文件,我有我的证件变数,但是当我调用我的第二个函数,我的凭证变量是空的。
的index.php
<?php
require_once("./connector/hot/hotelbeds/book.php");
if($_REQUEST['connector'] == 'hotelbeds')
{
require_once("connector/hot/hotelbeds/validate.php");
validate_hotelbeds($_REQUEST);
}
$booking_output = book_hotelbeds($_REQUEST);
?>
validate.php
<?php
function validate_hotelbeds($results)
{
$account = $results['header']['account'];
include_once("./connector/hot/hotelbeds/account_config/$account/config.php");
// $url contain my url
$validate = curl_get($url , $results);
}
?>
book.php中
<?php
function book_hotelbeds($results)
{
$account = $results['header']['account'];
include_once("./connector/hot/hotelbeds/account_config/$account/config.php");
// $url is empty
$book = curl_get($url , $results);
}
?>
的config.php
<?php
$url = "http://www.websitelink.com";
?>
不,在validate.php中,$ url不是空的 – user2942945