사용자 프로필을 폼에로드 한 다음 편집 할 수있는 페이스 북 스크립트를 디버깅하려고합니다.첫 번째로드시 PHP 배열이 반환되지 않습니다.
처음 페이지를로드 할 때 스크립트가 $user_profile
배열을 반환하지 않는 것이 문제입니다. 그러나 이후에 페이지를 새로 고치면 배열이 올바르게 반환됩니다.
이 배열을 페이지의 첫 번째로드시 반환하고 나머지 스크립트를 실행하려면 어떻게해야합니까? 그것은 AJAX
솔루션입니까, 아니면 JSON
입니까? 그렇다면 어떻게해야할까요? 사전에
감사합니다. 페이지가이가 리디렉션되는 경우
<?php
$is_fb = false;
$is_linkedin = false;
$reg_method = $_GET['conn_social'];
if (isset($_GET['in_uid'])){
$cur_in_uid = $_GET['in_uid'];
}
if ($reg_method == "facebook"){
$is_fb = true;
}
else if ($reg_method == "linkedin"){
$is_linkedin = true;
}
if($is_fb) {
global $fbconfig;
$facebook = new Facebook(array('appId' => $fbconfig['appid'],
'secret' => $fbconfig['secret'],
'cookie' => true));
$user = $facebook->getUser();
if ($user) {
try {
// Proceed knowing you have a logged in user who's authenticated.
$user_profile = $facebook->api('/me');
//the below line is for debugging only - THIS PRINTS ON SCREEN REFRESH ONLY
print_r($user_profile);
} catch (FacebookApiException $e) {
error_log($e);
$user = null;
}
}
$is_fb_uid_exist = hl_check_fb_uid_exist($user_profile['id']);
if($is_fb_uid_exist){
$is_fb = false;
}
try{
$fql = "select name, first_name, last_name, birthday_date, sex, profile_url, hometown_location, current_location, work, activities, interests, music, tv, movies, books, quotes, about_me, website, education, sports, inspirational_people, languages, pic_square from user where uid=" . $user;
$param = array('method' => 'fql.query',
'query' => $fql,
'callback' => '');
$fqlResult = $facebook->api($param);
}
}
?>
유는 정말 잘 형식의 코드를보고 너무 –
헤이의 질문과 관련이없는하지만 처음에 쿼리를 작성하려면 하드웨어를 확인하는 neeed! 오프 모자! –
u r}} 괄호 –