使用Facebook PHP SDK获取60天长的生活访问令牌的正确方法是什么?

Facebook is deprecating the offline_access permission. What is the proper way to get a long living (60 day) access token using the FB PHP SDK?

As it says in the API - just provide your old token. Either with CURL or file_get_contents, or php library.

https://graph.facebook.com/oauth/access_token?             
    client_id=APP_ID&
    client_secret=APP_SECRET&
    grant_type=fb_exchange_token&
    fb_exchange_token=EXISTING_ACCESS_TOKEN 

My way:

$url = "https://graph.facebook.com/oauth/access_token?client_id=$client_id&client_secret=$client_secret&grant_type=fb_exchange_token&fb_exchange_token=$fb_access_token";
$graph = file_get_contents($url);
$graph = explode("=", $graph);
$graph = explode("&", $graph[1]);
$fb_access_token = $graph[0];

You should ask for the new long lived access token first:

$new_access = $facebook->setExtendedAccessToken();
$access_token = $facebook->getAccessToken();

and of course you must use the latest PHP-SDK vv 3.1.1