當我想給另一個應用程序和類文件ex:Information.php中的另一個方法提供信息時,我有類文件ex:Stats.php。在Symfony中使用FOSTRestBundle調用另一個應用程序中的另一個類的方法
文件Stats.php
public function getStats()
{
$myInformations = // here i want to get information from Information.php
.
.
.
return $myInformations;
}
在不同的應用程序。 文件Informations.php
/**
* Get all locales
* @FOS\View()
* @FOS\Get("/locales")
* @param ParamFetcherInterface $paramFetcher
* @return mixed
*/
public function getLocales(ParamFetcherInterface $paramFetcher)
{
.
.
.
return $locales;
}
我如何調用函數getLocales從網址:函數中的getStatus http://myhost.com/api/locales()?
用GuzzleBundle解決。 –