感谢您的所有快速回复!虽然下面的代码看起来我想打印要在屏幕上查看的值,但我需要这些值,例如。$user_profile [email] 在另一个函数中(注册新的 wordpress 用户)。下面是完整的代码。我该怎么做呢?
<?php
try{
include_once "src/fbaccess.php";
}catch(Exception $e){
error_log($e);
}
try{
require_once "wp-blog-header.php";
}catch(Exception $e){
error_log($e);
}
try{
require_once "wp-includes/registration.php";
}catch(Exception $e){
error_log($e);
}
?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:fb="http://www.facebook.com/2008/fbml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<title>Florian's Facebook login</title>
</head>
<body>
<!-- Copy the below code to display FB Login/Logout button -->
<?php if ($user): ?>
<a href="<?php echo $logoutUrl; ?>">Logout</a>
<?php else: ?>
<div>
<a href="<?php echo $loginUrl; ?>">Login with Facebook</a>
</div>
<?php endif ?>
<!-- Copy the above code to display FB Login/Logout button -->
<h3>PHP Session</h3>
<pre><?php print_r($_SESSION); ?></pre>
<?php if ($user): ?>
<h3>You</h3>
<img src="https://graph.facebook.com/<?php echo $user; ?>/picture">
<h3>Your User Object (/me)</h3>
<pre><?php return ($user_profile [email]); ?></pre>
<pre><?php return ($user_profile [first_name]); ?></pre>
<pre><?php return ($user_profile [last_name]); ?></pre>
<pre><?php return ($user_profile [location]); ?></pre>
<?php else: ?>
<strong><em>You are not Connected.</em></strong>
<?php endif ?>